|
1
|
|
|
/*! |
|
2
|
|
|
* Bootstrap v4.0.0 (https://getbootstrap.com) |
|
3
|
|
|
* Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) |
|
4
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
5
|
|
|
*/ |
|
6
|
|
View Code Duplication |
(function (global, factory) { |
|
|
|
|
|
|
7
|
|
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) : |
|
8
|
|
|
typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) : |
|
|
|
|
|
|
9
|
|
|
(factory((global.bootstrap = {}),global.jQuery)); |
|
10
|
|
|
}(this, (function (exports,$) { 'use strict'; |
|
11
|
|
|
|
|
12
|
|
|
$ = $ && $.hasOwnProperty('default') ? $['default'] : $; |
|
13
|
|
|
|
|
14
|
|
|
function _defineProperties(target, props) { |
|
15
|
|
|
for (var i = 0; i < props.length; i++) { |
|
16
|
|
|
var descriptor = props[i]; |
|
17
|
|
|
descriptor.enumerable = descriptor.enumerable || false; |
|
18
|
|
|
descriptor.configurable = true; |
|
19
|
|
|
if ("value" in descriptor) descriptor.writable = true; |
|
20
|
|
|
Object.defineProperty(target, descriptor.key, descriptor); |
|
21
|
|
|
} |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
function _createClass(Constructor, protoProps, staticProps) { |
|
25
|
|
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
|
26
|
|
|
if (staticProps) _defineProperties(Constructor, staticProps); |
|
27
|
|
|
return Constructor; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
function _extends() { |
|
31
|
|
|
_extends = Object.assign || function (target) { |
|
|
|
|
|
|
32
|
|
|
for (var i = 1; i < arguments.length; i++) { |
|
33
|
|
|
var source = arguments[i]; |
|
34
|
|
|
|
|
35
|
|
|
for (var key in source) { |
|
|
|
|
|
|
36
|
|
|
if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
37
|
|
|
target[key] = source[key]; |
|
38
|
|
|
} |
|
39
|
|
|
} |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
return target; |
|
43
|
|
|
}; |
|
44
|
|
|
|
|
45
|
|
|
return _extends.apply(this, arguments); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
function _inheritsLoose(subClass, superClass) { |
|
49
|
|
|
subClass.prototype = Object.create(superClass.prototype); |
|
50
|
|
|
subClass.prototype.constructor = subClass; |
|
51
|
|
|
subClass.__proto__ = superClass; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* -------------------------------------------------------------------------- |
|
56
|
|
|
* Bootstrap (v4.0.0): util.js |
|
57
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
58
|
|
|
* -------------------------------------------------------------------------- |
|
59
|
|
|
*/ |
|
60
|
|
|
|
|
61
|
|
|
var Util = function ($$$1) { |
|
62
|
|
|
/** |
|
63
|
|
|
* ------------------------------------------------------------------------ |
|
64
|
|
|
* Private TransitionEnd Helpers |
|
65
|
|
|
* ------------------------------------------------------------------------ |
|
66
|
|
|
*/ |
|
67
|
|
|
var transition = false; |
|
68
|
|
|
var MAX_UID = 1000000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) |
|
69
|
|
|
|
|
70
|
|
|
function toType(obj) { |
|
71
|
|
|
return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
function getSpecialTransitionEndEvent() { |
|
75
|
|
|
return { |
|
76
|
|
|
bindType: transition.end, |
|
77
|
|
|
delegateType: transition.end, |
|
78
|
|
|
handle: function handle(event) { |
|
79
|
|
|
if ($$$1(event.target).is(this)) { |
|
80
|
|
|
return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
return undefined; // eslint-disable-line no-undefined |
|
84
|
|
|
} |
|
85
|
|
|
}; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
function transitionEndTest() { |
|
89
|
|
|
if (typeof window !== 'undefined' && window.QUnit) { |
|
90
|
|
|
return false; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
return { |
|
94
|
|
|
end: 'transitionend' |
|
95
|
|
|
}; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
function transitionEndEmulator(duration) { |
|
99
|
|
|
var _this = this; |
|
100
|
|
|
|
|
101
|
|
|
var called = false; |
|
102
|
|
|
$$$1(this).one(Util.TRANSITION_END, function () { |
|
103
|
|
|
called = true; |
|
104
|
|
|
}); |
|
105
|
|
|
setTimeout(function () { |
|
106
|
|
|
if (!called) { |
|
107
|
|
|
Util.triggerTransitionEnd(_this); |
|
108
|
|
|
} |
|
109
|
|
|
}, duration); |
|
110
|
|
|
return this; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
function setTransitionEndSupport() { |
|
114
|
|
|
transition = transitionEndTest(); |
|
115
|
|
|
$$$1.fn.emulateTransitionEnd = transitionEndEmulator; |
|
116
|
|
|
|
|
117
|
|
|
if (Util.supportsTransitionEnd()) { |
|
118
|
|
|
$$$1.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); |
|
119
|
|
|
} |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
function escapeId(selector) { |
|
123
|
|
|
// We escape IDs in case of special selectors (selector = '#myId:something') |
|
124
|
|
|
// $.escapeSelector does not exist in jQuery < 3 |
|
125
|
|
|
selector = typeof $$$1.escapeSelector === 'function' ? $$$1.escapeSelector(selector).substr(1) : selector.replace(/(:|\.|\[|\]|,|=|@)/g, '\\$1'); |
|
126
|
|
|
return selector; |
|
127
|
|
|
} |
|
128
|
|
|
/** |
|
129
|
|
|
* -------------------------------------------------------------------------- |
|
130
|
|
|
* Public Util Api |
|
131
|
|
|
* -------------------------------------------------------------------------- |
|
132
|
|
|
*/ |
|
133
|
|
|
|
|
134
|
|
|
|
|
135
|
|
|
var Util = { |
|
136
|
|
|
TRANSITION_END: 'bsTransitionEnd', |
|
137
|
|
|
getUID: function getUID(prefix) { |
|
138
|
|
|
do { |
|
139
|
|
|
// eslint-disable-next-line no-bitwise |
|
140
|
|
|
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here |
|
141
|
|
|
} while (document.getElementById(prefix)); |
|
142
|
|
|
|
|
143
|
|
|
return prefix; |
|
144
|
|
|
}, |
|
145
|
|
|
getSelectorFromElement: function getSelectorFromElement(element) { |
|
146
|
|
|
var selector = element.getAttribute('data-target'); |
|
147
|
|
|
|
|
148
|
|
|
if (!selector || selector === '#') { |
|
149
|
|
|
selector = element.getAttribute('href') || ''; |
|
150
|
|
|
} // If it's an ID |
|
151
|
|
|
|
|
152
|
|
|
|
|
153
|
|
|
if (selector.charAt(0) === '#') { |
|
154
|
|
|
selector = escapeId(selector); |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
try { |
|
158
|
|
|
var $selector = $$$1(document).find(selector); |
|
159
|
|
|
return $selector.length > 0 ? selector : null; |
|
160
|
|
|
} catch (err) { |
|
161
|
|
|
return null; |
|
162
|
|
|
} |
|
163
|
|
|
}, |
|
164
|
|
|
reflow: function reflow(element) { |
|
165
|
|
|
return element.offsetHeight; |
|
166
|
|
|
}, |
|
167
|
|
|
triggerTransitionEnd: function triggerTransitionEnd(element) { |
|
168
|
|
|
$$$1(element).trigger(transition.end); |
|
169
|
|
|
}, |
|
170
|
|
|
supportsTransitionEnd: function supportsTransitionEnd() { |
|
171
|
|
|
return Boolean(transition); |
|
172
|
|
|
}, |
|
173
|
|
|
isElement: function isElement(obj) { |
|
174
|
|
|
return (obj[0] || obj).nodeType; |
|
175
|
|
|
}, |
|
176
|
|
|
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { |
|
177
|
|
|
for (var property in configTypes) { |
|
|
|
|
|
|
178
|
|
|
if (Object.prototype.hasOwnProperty.call(configTypes, property)) { |
|
179
|
|
|
var expectedTypes = configTypes[property]; |
|
180
|
|
|
var value = config[property]; |
|
181
|
|
|
var valueType = value && Util.isElement(value) ? 'element' : toType(value); |
|
182
|
|
|
|
|
183
|
|
|
if (!new RegExp(expectedTypes).test(valueType)) { |
|
184
|
|
|
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); |
|
185
|
|
|
} |
|
186
|
|
|
} |
|
187
|
|
|
} |
|
188
|
|
|
} |
|
189
|
|
|
}; |
|
190
|
|
|
setTransitionEndSupport(); |
|
191
|
|
|
return Util; |
|
192
|
|
|
}($); |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* -------------------------------------------------------------------------- |
|
196
|
|
|
* Bootstrap (v4.0.0): alert.js |
|
197
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
198
|
|
|
* -------------------------------------------------------------------------- |
|
199
|
|
|
*/ |
|
200
|
|
|
|
|
201
|
|
|
var Alert = function ($$$1) { |
|
202
|
|
|
/** |
|
203
|
|
|
* ------------------------------------------------------------------------ |
|
204
|
|
|
* Constants |
|
205
|
|
|
* ------------------------------------------------------------------------ |
|
206
|
|
|
*/ |
|
207
|
|
|
var NAME = 'alert'; |
|
208
|
|
|
var VERSION = '4.0.0'; |
|
209
|
|
|
var DATA_KEY = 'bs.alert'; |
|
210
|
|
|
var EVENT_KEY = "." + DATA_KEY; |
|
211
|
|
|
var DATA_API_KEY = '.data-api'; |
|
212
|
|
|
var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; |
|
213
|
|
|
var TRANSITION_DURATION = 150; |
|
214
|
|
|
var Selector = { |
|
215
|
|
|
DISMISS: '[data-dismiss="alert"]' |
|
216
|
|
|
}; |
|
217
|
|
|
var Event = { |
|
218
|
|
|
CLOSE: "close" + EVENT_KEY, |
|
219
|
|
|
CLOSED: "closed" + EVENT_KEY, |
|
220
|
|
|
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY |
|
221
|
|
|
}; |
|
222
|
|
|
var ClassName = { |
|
223
|
|
|
ALERT: 'alert', |
|
224
|
|
|
FADE: 'fade', |
|
225
|
|
|
SHOW: 'show' |
|
226
|
|
|
/** |
|
227
|
|
|
* ------------------------------------------------------------------------ |
|
228
|
|
|
* Class Definition |
|
229
|
|
|
* ------------------------------------------------------------------------ |
|
230
|
|
|
*/ |
|
231
|
|
|
|
|
232
|
|
|
}; |
|
233
|
|
|
|
|
234
|
|
|
var Alert = |
|
235
|
|
|
/*#__PURE__*/ |
|
236
|
|
|
function () { |
|
237
|
|
|
function Alert(element) { |
|
238
|
|
|
this._element = element; |
|
239
|
|
|
} // Getters |
|
240
|
|
|
|
|
241
|
|
|
|
|
242
|
|
|
var _proto = Alert.prototype; |
|
243
|
|
|
|
|
244
|
|
|
// Public |
|
245
|
|
|
_proto.close = function close(element) { |
|
246
|
|
|
element = element || this._element; |
|
247
|
|
|
|
|
248
|
|
|
var rootElement = this._getRootElement(element); |
|
249
|
|
|
|
|
250
|
|
|
var customEvent = this._triggerCloseEvent(rootElement); |
|
251
|
|
|
|
|
252
|
|
|
if (customEvent.isDefaultPrevented()) { |
|
253
|
|
|
return; |
|
254
|
|
|
} |
|
255
|
|
|
|
|
256
|
|
|
this._removeElement(rootElement); |
|
257
|
|
|
}; |
|
258
|
|
|
|
|
259
|
|
|
_proto.dispose = function dispose() { |
|
260
|
|
|
$$$1.removeData(this._element, DATA_KEY); |
|
261
|
|
|
this._element = null; |
|
262
|
|
|
}; // Private |
|
263
|
|
|
|
|
264
|
|
|
|
|
265
|
|
|
_proto._getRootElement = function _getRootElement(element) { |
|
266
|
|
|
var selector = Util.getSelectorFromElement(element); |
|
267
|
|
|
var parent = false; |
|
268
|
|
|
|
|
269
|
|
|
if (selector) { |
|
270
|
|
|
parent = $$$1(selector)[0]; |
|
271
|
|
|
} |
|
272
|
|
|
|
|
273
|
|
|
if (!parent) { |
|
274
|
|
|
parent = $$$1(element).closest("." + ClassName.ALERT)[0]; |
|
275
|
|
|
} |
|
276
|
|
|
|
|
277
|
|
|
return parent; |
|
278
|
|
|
}; |
|
279
|
|
|
|
|
280
|
|
|
_proto._triggerCloseEvent = function _triggerCloseEvent(element) { |
|
281
|
|
|
var closeEvent = $$$1.Event(Event.CLOSE); |
|
282
|
|
|
$$$1(element).trigger(closeEvent); |
|
283
|
|
|
return closeEvent; |
|
284
|
|
|
}; |
|
285
|
|
|
|
|
286
|
|
|
_proto._removeElement = function _removeElement(element) { |
|
287
|
|
|
var _this = this; |
|
288
|
|
|
|
|
289
|
|
|
$$$1(element).removeClass(ClassName.SHOW); |
|
290
|
|
|
|
|
291
|
|
|
if (!Util.supportsTransitionEnd() || !$$$1(element).hasClass(ClassName.FADE)) { |
|
292
|
|
|
this._destroyElement(element); |
|
293
|
|
|
|
|
294
|
|
|
return; |
|
295
|
|
|
} |
|
296
|
|
|
|
|
297
|
|
|
$$$1(element).one(Util.TRANSITION_END, function (event) { |
|
298
|
|
|
return _this._destroyElement(element, event); |
|
299
|
|
|
}).emulateTransitionEnd(TRANSITION_DURATION); |
|
300
|
|
|
}; |
|
301
|
|
|
|
|
302
|
|
|
_proto._destroyElement = function _destroyElement(element) { |
|
303
|
|
|
$$$1(element).detach().trigger(Event.CLOSED).remove(); |
|
304
|
|
|
}; // Static |
|
305
|
|
|
|
|
306
|
|
|
|
|
307
|
|
|
Alert._jQueryInterface = function _jQueryInterface(config) { |
|
308
|
|
|
return this.each(function () { |
|
309
|
|
|
var $element = $$$1(this); |
|
310
|
|
|
var data = $element.data(DATA_KEY); |
|
311
|
|
|
|
|
312
|
|
|
if (!data) { |
|
313
|
|
|
data = new Alert(this); |
|
314
|
|
|
$element.data(DATA_KEY, data); |
|
315
|
|
|
} |
|
316
|
|
|
|
|
317
|
|
|
if (config === 'close') { |
|
318
|
|
|
data[config](this); |
|
319
|
|
|
} |
|
320
|
|
|
}); |
|
321
|
|
|
}; |
|
322
|
|
|
|
|
323
|
|
|
Alert._handleDismiss = function _handleDismiss(alertInstance) { |
|
324
|
|
|
return function (event) { |
|
325
|
|
|
if (event) { |
|
326
|
|
|
event.preventDefault(); |
|
327
|
|
|
} |
|
328
|
|
|
|
|
329
|
|
|
alertInstance.close(this); |
|
330
|
|
|
}; |
|
331
|
|
|
}; |
|
332
|
|
|
|
|
333
|
|
|
_createClass(Alert, null, [{ |
|
334
|
|
|
key: "VERSION", |
|
335
|
|
|
get: function get() { |
|
336
|
|
|
return VERSION; |
|
337
|
|
|
} |
|
338
|
|
|
}]); |
|
339
|
|
|
return Alert; |
|
340
|
|
|
}(); |
|
341
|
|
|
/** |
|
342
|
|
|
* ------------------------------------------------------------------------ |
|
343
|
|
|
* Data Api implementation |
|
344
|
|
|
* ------------------------------------------------------------------------ |
|
345
|
|
|
*/ |
|
346
|
|
|
|
|
347
|
|
|
|
|
348
|
|
|
$$$1(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); |
|
349
|
|
|
/** |
|
350
|
|
|
* ------------------------------------------------------------------------ |
|
351
|
|
|
* jQuery |
|
352
|
|
|
* ------------------------------------------------------------------------ |
|
353
|
|
|
*/ |
|
354
|
|
|
|
|
355
|
|
|
$$$1.fn[NAME] = Alert._jQueryInterface; |
|
356
|
|
|
$$$1.fn[NAME].Constructor = Alert; |
|
357
|
|
|
|
|
358
|
|
|
$$$1.fn[NAME].noConflict = function () { |
|
359
|
|
|
$$$1.fn[NAME] = JQUERY_NO_CONFLICT; |
|
360
|
|
|
return Alert._jQueryInterface; |
|
361
|
|
|
}; |
|
362
|
|
|
|
|
363
|
|
|
return Alert; |
|
364
|
|
|
}($); |
|
365
|
|
|
|
|
366
|
|
|
/** |
|
367
|
|
|
* -------------------------------------------------------------------------- |
|
368
|
|
|
* Bootstrap (v4.0.0): button.js |
|
369
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
370
|
|
|
* -------------------------------------------------------------------------- |
|
371
|
|
|
*/ |
|
372
|
|
|
|
|
373
|
|
|
var Button = function ($$$1) { |
|
374
|
|
|
/** |
|
375
|
|
|
* ------------------------------------------------------------------------ |
|
376
|
|
|
* Constants |
|
377
|
|
|
* ------------------------------------------------------------------------ |
|
378
|
|
|
*/ |
|
379
|
|
|
var NAME = 'button'; |
|
380
|
|
|
var VERSION = '4.0.0'; |
|
381
|
|
|
var DATA_KEY = 'bs.button'; |
|
382
|
|
|
var EVENT_KEY = "." + DATA_KEY; |
|
383
|
|
|
var DATA_API_KEY = '.data-api'; |
|
384
|
|
|
var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; |
|
385
|
|
|
var ClassName = { |
|
386
|
|
|
ACTIVE: 'active', |
|
387
|
|
|
BUTTON: 'btn', |
|
388
|
|
|
FOCUS: 'focus' |
|
389
|
|
|
}; |
|
390
|
|
|
var Selector = { |
|
391
|
|
|
DATA_TOGGLE_CARROT: '[data-toggle^="button"]', |
|
392
|
|
|
DATA_TOGGLE: '[data-toggle="buttons"]', |
|
393
|
|
|
INPUT: 'input', |
|
394
|
|
|
ACTIVE: '.active', |
|
395
|
|
|
BUTTON: '.btn' |
|
396
|
|
|
}; |
|
397
|
|
|
var Event = { |
|
398
|
|
|
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY, |
|
399
|
|
|
FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY + DATA_API_KEY + " " + ("blur" + EVENT_KEY + DATA_API_KEY) |
|
400
|
|
|
/** |
|
401
|
|
|
* ------------------------------------------------------------------------ |
|
402
|
|
|
* Class Definition |
|
403
|
|
|
* ------------------------------------------------------------------------ |
|
404
|
|
|
*/ |
|
405
|
|
|
|
|
406
|
|
|
}; |
|
407
|
|
|
|
|
408
|
|
|
var Button = |
|
409
|
|
|
/*#__PURE__*/ |
|
410
|
|
|
function () { |
|
411
|
|
|
function Button(element) { |
|
412
|
|
|
this._element = element; |
|
413
|
|
|
} // Getters |
|
414
|
|
|
|
|
415
|
|
|
|
|
416
|
|
|
var _proto = Button.prototype; |
|
417
|
|
|
|
|
418
|
|
|
// Public |
|
419
|
|
|
_proto.toggle = function toggle() { |
|
420
|
|
|
var triggerChangeEvent = true; |
|
421
|
|
|
var addAriaPressed = true; |
|
422
|
|
|
var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0]; |
|
423
|
|
|
|
|
424
|
|
|
if (rootElement) { |
|
425
|
|
|
var input = $$$1(this._element).find(Selector.INPUT)[0]; |
|
426
|
|
|
|
|
427
|
|
|
if (input) { |
|
428
|
|
|
if (input.type === 'radio') { |
|
429
|
|
|
if (input.checked && $$$1(this._element).hasClass(ClassName.ACTIVE)) { |
|
430
|
|
|
triggerChangeEvent = false; |
|
431
|
|
|
} else { |
|
432
|
|
|
var activeElement = $$$1(rootElement).find(Selector.ACTIVE)[0]; |
|
433
|
|
|
|
|
434
|
|
|
if (activeElement) { |
|
435
|
|
|
$$$1(activeElement).removeClass(ClassName.ACTIVE); |
|
436
|
|
|
} |
|
437
|
|
|
} |
|
438
|
|
|
} |
|
439
|
|
|
|
|
440
|
|
|
if (triggerChangeEvent) { |
|
441
|
|
|
if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) { |
|
442
|
|
|
return; |
|
443
|
|
|
} |
|
444
|
|
|
|
|
445
|
|
|
input.checked = !$$$1(this._element).hasClass(ClassName.ACTIVE); |
|
446
|
|
|
$$$1(input).trigger('change'); |
|
447
|
|
|
} |
|
448
|
|
|
|
|
449
|
|
|
input.focus(); |
|
450
|
|
|
addAriaPressed = false; |
|
451
|
|
|
} |
|
452
|
|
|
} |
|
453
|
|
|
|
|
454
|
|
|
if (addAriaPressed) { |
|
455
|
|
|
this._element.setAttribute('aria-pressed', !$$$1(this._element).hasClass(ClassName.ACTIVE)); |
|
456
|
|
|
} |
|
457
|
|
|
|
|
458
|
|
|
if (triggerChangeEvent) { |
|
459
|
|
|
$$$1(this._element).toggleClass(ClassName.ACTIVE); |
|
460
|
|
|
} |
|
461
|
|
|
}; |
|
462
|
|
|
|
|
463
|
|
|
_proto.dispose = function dispose() { |
|
464
|
|
|
$$$1.removeData(this._element, DATA_KEY); |
|
465
|
|
|
this._element = null; |
|
466
|
|
|
}; // Static |
|
467
|
|
|
|
|
468
|
|
|
|
|
469
|
|
|
Button._jQueryInterface = function _jQueryInterface(config) { |
|
470
|
|
|
return this.each(function () { |
|
471
|
|
|
var data = $$$1(this).data(DATA_KEY); |
|
472
|
|
|
|
|
473
|
|
|
if (!data) { |
|
474
|
|
|
data = new Button(this); |
|
475
|
|
|
$$$1(this).data(DATA_KEY, data); |
|
476
|
|
|
} |
|
477
|
|
|
|
|
478
|
|
|
if (config === 'toggle') { |
|
479
|
|
|
data[config](); |
|
480
|
|
|
} |
|
481
|
|
|
}); |
|
482
|
|
|
}; |
|
483
|
|
|
|
|
484
|
|
|
_createClass(Button, null, [{ |
|
485
|
|
|
key: "VERSION", |
|
486
|
|
|
get: function get() { |
|
487
|
|
|
return VERSION; |
|
488
|
|
|
} |
|
489
|
|
|
}]); |
|
490
|
|
|
return Button; |
|
491
|
|
|
}(); |
|
492
|
|
|
/** |
|
493
|
|
|
* ------------------------------------------------------------------------ |
|
494
|
|
|
* Data Api implementation |
|
495
|
|
|
* ------------------------------------------------------------------------ |
|
496
|
|
|
*/ |
|
497
|
|
|
|
|
498
|
|
|
|
|
499
|
|
|
$$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { |
|
500
|
|
|
event.preventDefault(); |
|
501
|
|
|
var button = event.target; |
|
502
|
|
|
|
|
503
|
|
|
if (!$$$1(button).hasClass(ClassName.BUTTON)) { |
|
504
|
|
|
button = $$$1(button).closest(Selector.BUTTON); |
|
505
|
|
|
} |
|
506
|
|
|
|
|
507
|
|
|
Button._jQueryInterface.call($$$1(button), 'toggle'); |
|
508
|
|
|
}).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { |
|
509
|
|
|
var button = $$$1(event.target).closest(Selector.BUTTON)[0]; |
|
510
|
|
|
$$$1(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type)); |
|
511
|
|
|
}); |
|
512
|
|
|
/** |
|
513
|
|
|
* ------------------------------------------------------------------------ |
|
514
|
|
|
* jQuery |
|
515
|
|
|
* ------------------------------------------------------------------------ |
|
516
|
|
|
*/ |
|
517
|
|
|
|
|
518
|
|
|
$$$1.fn[NAME] = Button._jQueryInterface; |
|
519
|
|
|
$$$1.fn[NAME].Constructor = Button; |
|
520
|
|
|
|
|
521
|
|
|
$$$1.fn[NAME].noConflict = function () { |
|
522
|
|
|
$$$1.fn[NAME] = JQUERY_NO_CONFLICT; |
|
523
|
|
|
return Button._jQueryInterface; |
|
524
|
|
|
}; |
|
525
|
|
|
|
|
526
|
|
|
return Button; |
|
527
|
|
|
}($); |
|
528
|
|
|
|
|
529
|
|
|
/** |
|
530
|
|
|
* -------------------------------------------------------------------------- |
|
531
|
|
|
* Bootstrap (v4.0.0): carousel.js |
|
532
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
533
|
|
|
* -------------------------------------------------------------------------- |
|
534
|
|
|
*/ |
|
535
|
|
|
|
|
536
|
|
|
var Carousel = function ($$$1) { |
|
537
|
|
|
/** |
|
538
|
|
|
* ------------------------------------------------------------------------ |
|
539
|
|
|
* Constants |
|
540
|
|
|
* ------------------------------------------------------------------------ |
|
541
|
|
|
*/ |
|
542
|
|
|
var NAME = 'carousel'; |
|
543
|
|
|
var VERSION = '4.0.0'; |
|
544
|
|
|
var DATA_KEY = 'bs.carousel'; |
|
545
|
|
|
var EVENT_KEY = "." + DATA_KEY; |
|
546
|
|
|
var DATA_API_KEY = '.data-api'; |
|
547
|
|
|
var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; |
|
548
|
|
|
var TRANSITION_DURATION = 600; |
|
549
|
|
|
var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key |
|
550
|
|
|
|
|
551
|
|
|
var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key |
|
552
|
|
|
|
|
553
|
|
|
var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch |
|
554
|
|
|
|
|
555
|
|
|
var Default = { |
|
556
|
|
|
interval: 5000, |
|
557
|
|
|
keyboard: true, |
|
558
|
|
|
slide: false, |
|
559
|
|
|
pause: 'hover', |
|
560
|
|
|
wrap: true |
|
561
|
|
|
}; |
|
562
|
|
|
var DefaultType = { |
|
563
|
|
|
interval: '(number|boolean)', |
|
564
|
|
|
keyboard: 'boolean', |
|
565
|
|
|
slide: '(boolean|string)', |
|
566
|
|
|
pause: '(string|boolean)', |
|
567
|
|
|
wrap: 'boolean' |
|
568
|
|
|
}; |
|
569
|
|
|
var Direction = { |
|
570
|
|
|
NEXT: 'next', |
|
571
|
|
|
PREV: 'prev', |
|
572
|
|
|
LEFT: 'left', |
|
573
|
|
|
RIGHT: 'right' |
|
574
|
|
|
}; |
|
575
|
|
|
var Event = { |
|
576
|
|
|
SLIDE: "slide" + EVENT_KEY, |
|
577
|
|
|
SLID: "slid" + EVENT_KEY, |
|
578
|
|
|
KEYDOWN: "keydown" + EVENT_KEY, |
|
579
|
|
|
MOUSEENTER: "mouseenter" + EVENT_KEY, |
|
580
|
|
|
MOUSELEAVE: "mouseleave" + EVENT_KEY, |
|
581
|
|
|
TOUCHEND: "touchend" + EVENT_KEY, |
|
582
|
|
|
LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY, |
|
583
|
|
|
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY |
|
584
|
|
|
}; |
|
585
|
|
|
var ClassName = { |
|
586
|
|
|
CAROUSEL: 'carousel', |
|
587
|
|
|
ACTIVE: 'active', |
|
588
|
|
|
SLIDE: 'slide', |
|
589
|
|
|
RIGHT: 'carousel-item-right', |
|
590
|
|
|
LEFT: 'carousel-item-left', |
|
591
|
|
|
NEXT: 'carousel-item-next', |
|
592
|
|
|
PREV: 'carousel-item-prev', |
|
593
|
|
|
ITEM: 'carousel-item' |
|
594
|
|
|
}; |
|
595
|
|
|
var Selector = { |
|
596
|
|
|
ACTIVE: '.active', |
|
597
|
|
|
ACTIVE_ITEM: '.active.carousel-item', |
|
598
|
|
|
ITEM: '.carousel-item', |
|
599
|
|
|
NEXT_PREV: '.carousel-item-next, .carousel-item-prev', |
|
600
|
|
|
INDICATORS: '.carousel-indicators', |
|
601
|
|
|
DATA_SLIDE: '[data-slide], [data-slide-to]', |
|
602
|
|
|
DATA_RIDE: '[data-ride="carousel"]' |
|
603
|
|
|
/** |
|
604
|
|
|
* ------------------------------------------------------------------------ |
|
605
|
|
|
* Class Definition |
|
606
|
|
|
* ------------------------------------------------------------------------ |
|
607
|
|
|
*/ |
|
608
|
|
|
|
|
609
|
|
|
}; |
|
610
|
|
|
|
|
611
|
|
|
var Carousel = |
|
612
|
|
|
/*#__PURE__*/ |
|
613
|
|
|
function () { |
|
614
|
|
|
function Carousel(element, config) { |
|
615
|
|
|
this._items = null; |
|
616
|
|
|
this._interval = null; |
|
617
|
|
|
this._activeElement = null; |
|
618
|
|
|
this._isPaused = false; |
|
619
|
|
|
this._isSliding = false; |
|
620
|
|
|
this.touchTimeout = null; |
|
621
|
|
|
this._config = this._getConfig(config); |
|
622
|
|
|
this._element = $$$1(element)[0]; |
|
623
|
|
|
this._indicatorsElement = $$$1(this._element).find(Selector.INDICATORS)[0]; |
|
624
|
|
|
|
|
625
|
|
|
this._addEventListeners(); |
|
626
|
|
|
} // Getters |
|
627
|
|
|
|
|
628
|
|
|
|
|
629
|
|
|
var _proto = Carousel.prototype; |
|
630
|
|
|
|
|
631
|
|
|
// Public |
|
632
|
|
|
_proto.next = function next() { |
|
633
|
|
|
if (!this._isSliding) { |
|
634
|
|
|
this._slide(Direction.NEXT); |
|
635
|
|
|
} |
|
636
|
|
|
}; |
|
637
|
|
|
|
|
638
|
|
|
_proto.nextWhenVisible = function nextWhenVisible() { |
|
639
|
|
|
// Don't call next when the page isn't visible |
|
640
|
|
|
// or the carousel or its parent isn't visible |
|
641
|
|
|
if (!document.hidden && $$$1(this._element).is(':visible') && $$$1(this._element).css('visibility') !== 'hidden') { |
|
642
|
|
|
this.next(); |
|
643
|
|
|
} |
|
644
|
|
|
}; |
|
645
|
|
|
|
|
646
|
|
|
_proto.prev = function prev() { |
|
647
|
|
|
if (!this._isSliding) { |
|
648
|
|
|
this._slide(Direction.PREV); |
|
649
|
|
|
} |
|
650
|
|
|
}; |
|
651
|
|
|
|
|
652
|
|
|
_proto.pause = function pause(event) { |
|
653
|
|
|
if (!event) { |
|
654
|
|
|
this._isPaused = true; |
|
655
|
|
|
} |
|
656
|
|
|
|
|
657
|
|
|
if ($$$1(this._element).find(Selector.NEXT_PREV)[0] && Util.supportsTransitionEnd()) { |
|
658
|
|
|
Util.triggerTransitionEnd(this._element); |
|
659
|
|
|
this.cycle(true); |
|
660
|
|
|
} |
|
661
|
|
|
|
|
662
|
|
|
clearInterval(this._interval); |
|
663
|
|
|
this._interval = null; |
|
664
|
|
|
}; |
|
665
|
|
|
|
|
666
|
|
|
_proto.cycle = function cycle(event) { |
|
667
|
|
|
if (!event) { |
|
668
|
|
|
this._isPaused = false; |
|
669
|
|
|
} |
|
670
|
|
|
|
|
671
|
|
|
if (this._interval) { |
|
672
|
|
|
clearInterval(this._interval); |
|
673
|
|
|
this._interval = null; |
|
674
|
|
|
} |
|
675
|
|
|
|
|
676
|
|
|
if (this._config.interval && !this._isPaused) { |
|
677
|
|
|
this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); |
|
678
|
|
|
} |
|
679
|
|
|
}; |
|
680
|
|
|
|
|
681
|
|
|
_proto.to = function to(index) { |
|
682
|
|
|
var _this = this; |
|
683
|
|
|
|
|
684
|
|
|
this._activeElement = $$$1(this._element).find(Selector.ACTIVE_ITEM)[0]; |
|
685
|
|
|
|
|
686
|
|
|
var activeIndex = this._getItemIndex(this._activeElement); |
|
687
|
|
|
|
|
688
|
|
|
if (index > this._items.length - 1 || index < 0) { |
|
689
|
|
|
return; |
|
690
|
|
|
} |
|
691
|
|
|
|
|
692
|
|
|
if (this._isSliding) { |
|
693
|
|
|
$$$1(this._element).one(Event.SLID, function () { |
|
694
|
|
|
return _this.to(index); |
|
695
|
|
|
}); |
|
696
|
|
|
return; |
|
697
|
|
|
} |
|
698
|
|
|
|
|
699
|
|
|
if (activeIndex === index) { |
|
700
|
|
|
this.pause(); |
|
701
|
|
|
this.cycle(); |
|
702
|
|
|
return; |
|
703
|
|
|
} |
|
704
|
|
|
|
|
705
|
|
|
var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; |
|
706
|
|
|
|
|
707
|
|
|
this._slide(direction, this._items[index]); |
|
708
|
|
|
}; |
|
709
|
|
|
|
|
710
|
|
|
_proto.dispose = function dispose() { |
|
711
|
|
|
$$$1(this._element).off(EVENT_KEY); |
|
712
|
|
|
$$$1.removeData(this._element, DATA_KEY); |
|
713
|
|
|
this._items = null; |
|
714
|
|
|
this._config = null; |
|
715
|
|
|
this._element = null; |
|
716
|
|
|
this._interval = null; |
|
717
|
|
|
this._isPaused = null; |
|
718
|
|
|
this._isSliding = null; |
|
719
|
|
|
this._activeElement = null; |
|
720
|
|
|
this._indicatorsElement = null; |
|
721
|
|
|
}; // Private |
|
722
|
|
|
|
|
723
|
|
|
|
|
724
|
|
|
_proto._getConfig = function _getConfig(config) { |
|
725
|
|
|
config = _extends({}, Default, config); |
|
726
|
|
|
Util.typeCheckConfig(NAME, config, DefaultType); |
|
727
|
|
|
return config; |
|
728
|
|
|
}; |
|
729
|
|
|
|
|
730
|
|
|
_proto._addEventListeners = function _addEventListeners() { |
|
731
|
|
|
var _this2 = this; |
|
732
|
|
|
|
|
733
|
|
|
if (this._config.keyboard) { |
|
734
|
|
|
$$$1(this._element).on(Event.KEYDOWN, function (event) { |
|
735
|
|
|
return _this2._keydown(event); |
|
736
|
|
|
}); |
|
737
|
|
|
} |
|
738
|
|
|
|
|
739
|
|
|
if (this._config.pause === 'hover') { |
|
740
|
|
|
$$$1(this._element).on(Event.MOUSEENTER, function (event) { |
|
741
|
|
|
return _this2.pause(event); |
|
742
|
|
|
}).on(Event.MOUSELEAVE, function (event) { |
|
743
|
|
|
return _this2.cycle(event); |
|
744
|
|
|
}); |
|
745
|
|
|
|
|
746
|
|
|
if ('ontouchstart' in document.documentElement) { |
|
747
|
|
|
// If it's a touch-enabled device, mouseenter/leave are fired as |
|
748
|
|
|
// part of the mouse compatibility events on first tap - the carousel |
|
749
|
|
|
// would stop cycling until user tapped out of it; |
|
750
|
|
|
// here, we listen for touchend, explicitly pause the carousel |
|
751
|
|
|
// (as if it's the second time we tap on it, mouseenter compat event |
|
752
|
|
|
// is NOT fired) and after a timeout (to allow for mouse compatibility |
|
753
|
|
|
// events to fire) we explicitly restart cycling |
|
754
|
|
|
$$$1(this._element).on(Event.TOUCHEND, function () { |
|
755
|
|
|
_this2.pause(); |
|
756
|
|
|
|
|
757
|
|
|
if (_this2.touchTimeout) { |
|
758
|
|
|
clearTimeout(_this2.touchTimeout); |
|
759
|
|
|
} |
|
760
|
|
|
|
|
761
|
|
|
_this2.touchTimeout = setTimeout(function (event) { |
|
762
|
|
|
return _this2.cycle(event); |
|
763
|
|
|
}, TOUCHEVENT_COMPAT_WAIT + _this2._config.interval); |
|
764
|
|
|
}); |
|
765
|
|
|
} |
|
766
|
|
|
} |
|
767
|
|
|
}; |
|
768
|
|
|
|
|
769
|
|
|
_proto._keydown = function _keydown(event) { |
|
770
|
|
|
if (/input|textarea/i.test(event.target.tagName)) { |
|
771
|
|
|
return; |
|
772
|
|
|
} |
|
773
|
|
|
|
|
774
|
|
|
switch (event.which) { |
|
775
|
|
|
case ARROW_LEFT_KEYCODE: |
|
776
|
|
|
event.preventDefault(); |
|
777
|
|
|
this.prev(); |
|
778
|
|
|
break; |
|
779
|
|
|
|
|
780
|
|
|
case ARROW_RIGHT_KEYCODE: |
|
781
|
|
|
event.preventDefault(); |
|
782
|
|
|
this.next(); |
|
783
|
|
|
break; |
|
784
|
|
|
|
|
785
|
|
|
default: |
|
786
|
|
|
} |
|
787
|
|
|
}; |
|
788
|
|
|
|
|
789
|
|
|
_proto._getItemIndex = function _getItemIndex(element) { |
|
790
|
|
|
this._items = $$$1.makeArray($$$1(element).parent().find(Selector.ITEM)); |
|
791
|
|
|
return this._items.indexOf(element); |
|
792
|
|
|
}; |
|
793
|
|
|
|
|
794
|
|
|
_proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { |
|
795
|
|
|
var isNextDirection = direction === Direction.NEXT; |
|
796
|
|
|
var isPrevDirection = direction === Direction.PREV; |
|
797
|
|
|
|
|
798
|
|
|
var activeIndex = this._getItemIndex(activeElement); |
|
799
|
|
|
|
|
800
|
|
|
var lastItemIndex = this._items.length - 1; |
|
801
|
|
|
var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; |
|
802
|
|
|
|
|
803
|
|
|
if (isGoingToWrap && !this._config.wrap) { |
|
804
|
|
|
return activeElement; |
|
805
|
|
|
} |
|
806
|
|
|
|
|
807
|
|
|
var delta = direction === Direction.PREV ? -1 : 1; |
|
808
|
|
|
var itemIndex = (activeIndex + delta) % this._items.length; |
|
809
|
|
|
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; |
|
810
|
|
|
}; |
|
811
|
|
|
|
|
812
|
|
|
_proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { |
|
813
|
|
|
var targetIndex = this._getItemIndex(relatedTarget); |
|
814
|
|
|
|
|
815
|
|
|
var fromIndex = this._getItemIndex($$$1(this._element).find(Selector.ACTIVE_ITEM)[0]); |
|
816
|
|
|
|
|
817
|
|
|
var slideEvent = $$$1.Event(Event.SLIDE, { |
|
818
|
|
|
relatedTarget: relatedTarget, |
|
819
|
|
|
direction: eventDirectionName, |
|
820
|
|
|
from: fromIndex, |
|
821
|
|
|
to: targetIndex |
|
822
|
|
|
}); |
|
823
|
|
|
$$$1(this._element).trigger(slideEvent); |
|
824
|
|
|
return slideEvent; |
|
825
|
|
|
}; |
|
826
|
|
|
|
|
827
|
|
|
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { |
|
828
|
|
|
if (this._indicatorsElement) { |
|
829
|
|
|
$$$1(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE); |
|
830
|
|
|
|
|
831
|
|
|
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; |
|
832
|
|
|
|
|
833
|
|
|
if (nextIndicator) { |
|
834
|
|
|
$$$1(nextIndicator).addClass(ClassName.ACTIVE); |
|
835
|
|
|
} |
|
836
|
|
|
} |
|
837
|
|
|
}; |
|
838
|
|
|
|
|
839
|
|
|
_proto._slide = function _slide(direction, element) { |
|
840
|
|
|
var _this3 = this; |
|
841
|
|
|
|
|
842
|
|
|
var activeElement = $$$1(this._element).find(Selector.ACTIVE_ITEM)[0]; |
|
843
|
|
|
|
|
844
|
|
|
var activeElementIndex = this._getItemIndex(activeElement); |
|
845
|
|
|
|
|
846
|
|
|
var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); |
|
847
|
|
|
|
|
848
|
|
|
var nextElementIndex = this._getItemIndex(nextElement); |
|
849
|
|
|
|
|
850
|
|
|
var isCycling = Boolean(this._interval); |
|
851
|
|
|
var directionalClassName; |
|
852
|
|
|
var orderClassName; |
|
853
|
|
|
var eventDirectionName; |
|
854
|
|
|
|
|
855
|
|
|
if (direction === Direction.NEXT) { |
|
856
|
|
|
directionalClassName = ClassName.LEFT; |
|
857
|
|
|
orderClassName = ClassName.NEXT; |
|
858
|
|
|
eventDirectionName = Direction.LEFT; |
|
859
|
|
|
} else { |
|
860
|
|
|
directionalClassName = ClassName.RIGHT; |
|
861
|
|
|
orderClassName = ClassName.PREV; |
|
862
|
|
|
eventDirectionName = Direction.RIGHT; |
|
863
|
|
|
} |
|
864
|
|
|
|
|
865
|
|
|
if (nextElement && $$$1(nextElement).hasClass(ClassName.ACTIVE)) { |
|
866
|
|
|
this._isSliding = false; |
|
867
|
|
|
return; |
|
868
|
|
|
} |
|
869
|
|
|
|
|
870
|
|
|
var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); |
|
871
|
|
|
|
|
872
|
|
|
if (slideEvent.isDefaultPrevented()) { |
|
873
|
|
|
return; |
|
874
|
|
|
} |
|
875
|
|
|
|
|
876
|
|
|
if (!activeElement || !nextElement) { |
|
877
|
|
|
// Some weirdness is happening, so we bail |
|
878
|
|
|
return; |
|
879
|
|
|
} |
|
880
|
|
|
|
|
881
|
|
|
this._isSliding = true; |
|
882
|
|
|
|
|
883
|
|
|
if (isCycling) { |
|
884
|
|
|
this.pause(); |
|
885
|
|
|
} |
|
886
|
|
|
|
|
887
|
|
|
this._setActiveIndicatorElement(nextElement); |
|
888
|
|
|
|
|
889
|
|
|
var slidEvent = $$$1.Event(Event.SLID, { |
|
890
|
|
|
relatedTarget: nextElement, |
|
891
|
|
|
direction: eventDirectionName, |
|
892
|
|
|
from: activeElementIndex, |
|
893
|
|
|
to: nextElementIndex |
|
894
|
|
|
}); |
|
895
|
|
|
|
|
896
|
|
|
if (Util.supportsTransitionEnd() && $$$1(this._element).hasClass(ClassName.SLIDE)) { |
|
897
|
|
|
$$$1(nextElement).addClass(orderClassName); |
|
898
|
|
|
Util.reflow(nextElement); |
|
899
|
|
|
$$$1(activeElement).addClass(directionalClassName); |
|
900
|
|
|
$$$1(nextElement).addClass(directionalClassName); |
|
901
|
|
|
$$$1(activeElement).one(Util.TRANSITION_END, function () { |
|
902
|
|
|
$$$1(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE); |
|
903
|
|
|
$$$1(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName); |
|
904
|
|
|
_this3._isSliding = false; |
|
905
|
|
|
setTimeout(function () { |
|
906
|
|
|
return $$$1(_this3._element).trigger(slidEvent); |
|
907
|
|
|
}, 0); |
|
908
|
|
|
}).emulateTransitionEnd(TRANSITION_DURATION); |
|
909
|
|
|
} else { |
|
910
|
|
|
$$$1(activeElement).removeClass(ClassName.ACTIVE); |
|
911
|
|
|
$$$1(nextElement).addClass(ClassName.ACTIVE); |
|
912
|
|
|
this._isSliding = false; |
|
913
|
|
|
$$$1(this._element).trigger(slidEvent); |
|
914
|
|
|
} |
|
915
|
|
|
|
|
916
|
|
|
if (isCycling) { |
|
917
|
|
|
this.cycle(); |
|
918
|
|
|
} |
|
919
|
|
|
}; // Static |
|
920
|
|
|
|
|
921
|
|
|
|
|
922
|
|
|
Carousel._jQueryInterface = function _jQueryInterface(config) { |
|
923
|
|
|
return this.each(function () { |
|
924
|
|
|
var data = $$$1(this).data(DATA_KEY); |
|
925
|
|
|
|
|
926
|
|
|
var _config = _extends({}, Default, $$$1(this).data()); |
|
927
|
|
|
|
|
928
|
|
|
if (typeof config === 'object') { |
|
929
|
|
|
_config = _extends({}, _config, config); |
|
930
|
|
|
} |
|
931
|
|
|
|
|
932
|
|
|
var action = typeof config === 'string' ? config : _config.slide; |
|
933
|
|
|
|
|
934
|
|
|
if (!data) { |
|
935
|
|
|
data = new Carousel(this, _config); |
|
936
|
|
|
$$$1(this).data(DATA_KEY, data); |
|
937
|
|
|
} |
|
938
|
|
|
|
|
939
|
|
|
if (typeof config === 'number') { |
|
940
|
|
|
data.to(config); |
|
941
|
|
|
} else if (typeof action === 'string') { |
|
942
|
|
|
if (typeof data[action] === 'undefined') { |
|
943
|
|
|
throw new TypeError("No method named \"" + action + "\""); |
|
944
|
|
|
} |
|
945
|
|
|
|
|
946
|
|
|
data[action](); |
|
947
|
|
|
} else if (_config.interval) { |
|
948
|
|
|
data.pause(); |
|
949
|
|
|
data.cycle(); |
|
950
|
|
|
} |
|
951
|
|
|
}); |
|
952
|
|
|
}; |
|
953
|
|
|
|
|
954
|
|
|
Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { |
|
955
|
|
|
var selector = Util.getSelectorFromElement(this); |
|
956
|
|
|
|
|
957
|
|
|
if (!selector) { |
|
958
|
|
|
return; |
|
959
|
|
|
} |
|
960
|
|
|
|
|
961
|
|
|
var target = $$$1(selector)[0]; |
|
962
|
|
|
|
|
963
|
|
|
if (!target || !$$$1(target).hasClass(ClassName.CAROUSEL)) { |
|
964
|
|
|
return; |
|
965
|
|
|
} |
|
966
|
|
|
|
|
967
|
|
|
var config = _extends({}, $$$1(target).data(), $$$1(this).data()); |
|
968
|
|
|
var slideIndex = this.getAttribute('data-slide-to'); |
|
969
|
|
|
|
|
970
|
|
|
if (slideIndex) { |
|
971
|
|
|
config.interval = false; |
|
972
|
|
|
} |
|
973
|
|
|
|
|
974
|
|
|
Carousel._jQueryInterface.call($$$1(target), config); |
|
975
|
|
|
|
|
976
|
|
|
if (slideIndex) { |
|
977
|
|
|
$$$1(target).data(DATA_KEY).to(slideIndex); |
|
978
|
|
|
} |
|
979
|
|
|
|
|
980
|
|
|
event.preventDefault(); |
|
981
|
|
|
}; |
|
982
|
|
|
|
|
983
|
|
|
_createClass(Carousel, null, [{ |
|
984
|
|
|
key: "VERSION", |
|
985
|
|
|
get: function get() { |
|
986
|
|
|
return VERSION; |
|
987
|
|
|
} |
|
988
|
|
|
}, { |
|
989
|
|
|
key: "Default", |
|
990
|
|
|
get: function get() { |
|
991
|
|
|
return Default; |
|
992
|
|
|
} |
|
993
|
|
|
}]); |
|
994
|
|
|
return Carousel; |
|
995
|
|
|
}(); |
|
996
|
|
|
/** |
|
997
|
|
|
* ------------------------------------------------------------------------ |
|
998
|
|
|
* Data Api implementation |
|
999
|
|
|
* ------------------------------------------------------------------------ |
|
1000
|
|
|
*/ |
|
1001
|
|
|
|
|
1002
|
|
|
|
|
1003
|
|
|
$$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler); |
|
1004
|
|
|
$$$1(window).on(Event.LOAD_DATA_API, function () { |
|
1005
|
|
|
$$$1(Selector.DATA_RIDE).each(function () { |
|
1006
|
|
|
var $carousel = $$$1(this); |
|
1007
|
|
|
|
|
1008
|
|
|
Carousel._jQueryInterface.call($carousel, $carousel.data()); |
|
1009
|
|
|
}); |
|
1010
|
|
|
}); |
|
1011
|
|
|
/** |
|
1012
|
|
|
* ------------------------------------------------------------------------ |
|
1013
|
|
|
* jQuery |
|
1014
|
|
|
* ------------------------------------------------------------------------ |
|
1015
|
|
|
*/ |
|
1016
|
|
|
|
|
1017
|
|
|
$$$1.fn[NAME] = Carousel._jQueryInterface; |
|
1018
|
|
|
$$$1.fn[NAME].Constructor = Carousel; |
|
1019
|
|
|
|
|
1020
|
|
|
$$$1.fn[NAME].noConflict = function () { |
|
1021
|
|
|
$$$1.fn[NAME] = JQUERY_NO_CONFLICT; |
|
1022
|
|
|
return Carousel._jQueryInterface; |
|
1023
|
|
|
}; |
|
1024
|
|
|
|
|
1025
|
|
|
return Carousel; |
|
1026
|
|
|
}($); |
|
1027
|
|
|
|
|
1028
|
|
|
/** |
|
1029
|
|
|
* -------------------------------------------------------------------------- |
|
1030
|
|
|
* Bootstrap (v4.0.0): collapse.js |
|
1031
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
1032
|
|
|
* -------------------------------------------------------------------------- |
|
1033
|
|
|
*/ |
|
1034
|
|
|
|
|
1035
|
|
|
var Collapse = function ($$$1) { |
|
1036
|
|
|
/** |
|
1037
|
|
|
* ------------------------------------------------------------------------ |
|
1038
|
|
|
* Constants |
|
1039
|
|
|
* ------------------------------------------------------------------------ |
|
1040
|
|
|
*/ |
|
1041
|
|
|
var NAME = 'collapse'; |
|
1042
|
|
|
var VERSION = '4.0.0'; |
|
1043
|
|
|
var DATA_KEY = 'bs.collapse'; |
|
1044
|
|
|
var EVENT_KEY = "." + DATA_KEY; |
|
1045
|
|
|
var DATA_API_KEY = '.data-api'; |
|
1046
|
|
|
var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; |
|
1047
|
|
|
var TRANSITION_DURATION = 600; |
|
1048
|
|
|
var Default = { |
|
1049
|
|
|
toggle: true, |
|
1050
|
|
|
parent: '' |
|
1051
|
|
|
}; |
|
1052
|
|
|
var DefaultType = { |
|
1053
|
|
|
toggle: 'boolean', |
|
1054
|
|
|
parent: '(string|element)' |
|
1055
|
|
|
}; |
|
1056
|
|
|
var Event = { |
|
1057
|
|
|
SHOW: "show" + EVENT_KEY, |
|
1058
|
|
|
SHOWN: "shown" + EVENT_KEY, |
|
1059
|
|
|
HIDE: "hide" + EVENT_KEY, |
|
1060
|
|
|
HIDDEN: "hidden" + EVENT_KEY, |
|
1061
|
|
|
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY |
|
1062
|
|
|
}; |
|
1063
|
|
|
var ClassName = { |
|
1064
|
|
|
SHOW: 'show', |
|
1065
|
|
|
COLLAPSE: 'collapse', |
|
1066
|
|
|
COLLAPSING: 'collapsing', |
|
1067
|
|
|
COLLAPSED: 'collapsed' |
|
1068
|
|
|
}; |
|
1069
|
|
|
var Dimension = { |
|
1070
|
|
|
WIDTH: 'width', |
|
1071
|
|
|
HEIGHT: 'height' |
|
1072
|
|
|
}; |
|
1073
|
|
|
var Selector = { |
|
1074
|
|
|
ACTIVES: '.show, .collapsing', |
|
1075
|
|
|
DATA_TOGGLE: '[data-toggle="collapse"]' |
|
1076
|
|
|
/** |
|
1077
|
|
|
* ------------------------------------------------------------------------ |
|
1078
|
|
|
* Class Definition |
|
1079
|
|
|
* ------------------------------------------------------------------------ |
|
1080
|
|
|
*/ |
|
1081
|
|
|
|
|
1082
|
|
|
}; |
|
1083
|
|
|
|
|
1084
|
|
|
var Collapse = |
|
1085
|
|
|
/*#__PURE__*/ |
|
1086
|
|
|
function () { |
|
1087
|
|
|
function Collapse(element, config) { |
|
1088
|
|
|
this._isTransitioning = false; |
|
1089
|
|
|
this._element = element; |
|
1090
|
|
|
this._config = this._getConfig(config); |
|
1091
|
|
|
this._triggerArray = $$$1.makeArray($$$1("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); |
|
1092
|
|
|
var tabToggles = $$$1(Selector.DATA_TOGGLE); |
|
1093
|
|
|
|
|
1094
|
|
|
for (var i = 0; i < tabToggles.length; i++) { |
|
1095
|
|
|
var elem = tabToggles[i]; |
|
1096
|
|
|
var selector = Util.getSelectorFromElement(elem); |
|
1097
|
|
|
|
|
1098
|
|
|
if (selector !== null && $$$1(selector).filter(element).length > 0) { |
|
1099
|
|
|
this._selector = selector; |
|
1100
|
|
|
|
|
1101
|
|
|
this._triggerArray.push(elem); |
|
1102
|
|
|
} |
|
1103
|
|
|
} |
|
1104
|
|
|
|
|
1105
|
|
|
this._parent = this._config.parent ? this._getParent() : null; |
|
1106
|
|
|
|
|
1107
|
|
|
if (!this._config.parent) { |
|
1108
|
|
|
this._addAriaAndCollapsedClass(this._element, this._triggerArray); |
|
1109
|
|
|
} |
|
1110
|
|
|
|
|
1111
|
|
|
if (this._config.toggle) { |
|
1112
|
|
|
this.toggle(); |
|
1113
|
|
|
} |
|
1114
|
|
|
} // Getters |
|
1115
|
|
|
|
|
1116
|
|
|
|
|
1117
|
|
|
var _proto = Collapse.prototype; |
|
1118
|
|
|
|
|
1119
|
|
|
// Public |
|
1120
|
|
|
_proto.toggle = function toggle() { |
|
1121
|
|
|
if ($$$1(this._element).hasClass(ClassName.SHOW)) { |
|
1122
|
|
|
this.hide(); |
|
1123
|
|
|
} else { |
|
1124
|
|
|
this.show(); |
|
1125
|
|
|
} |
|
1126
|
|
|
}; |
|
1127
|
|
|
|
|
1128
|
|
|
_proto.show = function show() { |
|
1129
|
|
|
var _this = this; |
|
1130
|
|
|
|
|
1131
|
|
|
if (this._isTransitioning || $$$1(this._element).hasClass(ClassName.SHOW)) { |
|
1132
|
|
|
return; |
|
1133
|
|
|
} |
|
1134
|
|
|
|
|
1135
|
|
|
var actives; |
|
1136
|
|
|
var activesData; |
|
1137
|
|
|
|
|
1138
|
|
|
if (this._parent) { |
|
1139
|
|
|
actives = $$$1.makeArray($$$1(this._parent).find(Selector.ACTIVES).filter("[data-parent=\"" + this._config.parent + "\"]")); |
|
1140
|
|
|
|
|
1141
|
|
|
if (actives.length === 0) { |
|
1142
|
|
|
actives = null; |
|
1143
|
|
|
} |
|
1144
|
|
|
} |
|
1145
|
|
|
|
|
1146
|
|
|
if (actives) { |
|
1147
|
|
|
activesData = $$$1(actives).not(this._selector).data(DATA_KEY); |
|
1148
|
|
|
|
|
1149
|
|
|
if (activesData && activesData._isTransitioning) { |
|
1150
|
|
|
return; |
|
1151
|
|
|
} |
|
1152
|
|
|
} |
|
1153
|
|
|
|
|
1154
|
|
|
var startEvent = $$$1.Event(Event.SHOW); |
|
1155
|
|
|
$$$1(this._element).trigger(startEvent); |
|
1156
|
|
|
|
|
1157
|
|
|
if (startEvent.isDefaultPrevented()) { |
|
1158
|
|
|
return; |
|
1159
|
|
|
} |
|
1160
|
|
|
|
|
1161
|
|
|
if (actives) { |
|
1162
|
|
|
Collapse._jQueryInterface.call($$$1(actives).not(this._selector), 'hide'); |
|
1163
|
|
|
|
|
1164
|
|
|
if (!activesData) { |
|
1165
|
|
|
$$$1(actives).data(DATA_KEY, null); |
|
1166
|
|
|
} |
|
1167
|
|
|
} |
|
1168
|
|
|
|
|
1169
|
|
|
var dimension = this._getDimension(); |
|
1170
|
|
|
|
|
1171
|
|
|
$$$1(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING); |
|
1172
|
|
|
this._element.style[dimension] = 0; |
|
1173
|
|
|
|
|
1174
|
|
|
if (this._triggerArray.length > 0) { |
|
1175
|
|
|
$$$1(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true); |
|
1176
|
|
|
} |
|
1177
|
|
|
|
|
1178
|
|
|
this.setTransitioning(true); |
|
1179
|
|
|
|
|
1180
|
|
|
var complete = function complete() { |
|
1181
|
|
|
$$$1(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW); |
|
1182
|
|
|
_this._element.style[dimension] = ''; |
|
1183
|
|
|
|
|
1184
|
|
|
_this.setTransitioning(false); |
|
1185
|
|
|
|
|
1186
|
|
|
$$$1(_this._element).trigger(Event.SHOWN); |
|
1187
|
|
|
}; |
|
1188
|
|
|
|
|
1189
|
|
|
if (!Util.supportsTransitionEnd()) { |
|
1190
|
|
|
complete(); |
|
1191
|
|
|
return; |
|
1192
|
|
|
} |
|
1193
|
|
|
|
|
1194
|
|
|
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); |
|
1195
|
|
|
var scrollSize = "scroll" + capitalizedDimension; |
|
1196
|
|
|
$$$1(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); |
|
1197
|
|
|
this._element.style[dimension] = this._element[scrollSize] + "px"; |
|
1198
|
|
|
}; |
|
1199
|
|
|
|
|
1200
|
|
|
_proto.hide = function hide() { |
|
1201
|
|
|
var _this2 = this; |
|
1202
|
|
|
|
|
1203
|
|
|
if (this._isTransitioning || !$$$1(this._element).hasClass(ClassName.SHOW)) { |
|
1204
|
|
|
return; |
|
1205
|
|
|
} |
|
1206
|
|
|
|
|
1207
|
|
|
var startEvent = $$$1.Event(Event.HIDE); |
|
1208
|
|
|
$$$1(this._element).trigger(startEvent); |
|
1209
|
|
|
|
|
1210
|
|
|
if (startEvent.isDefaultPrevented()) { |
|
1211
|
|
|
return; |
|
1212
|
|
|
} |
|
1213
|
|
|
|
|
1214
|
|
|
var dimension = this._getDimension(); |
|
1215
|
|
|
|
|
1216
|
|
|
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; |
|
1217
|
|
|
Util.reflow(this._element); |
|
1218
|
|
|
$$$1(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW); |
|
1219
|
|
|
|
|
1220
|
|
|
if (this._triggerArray.length > 0) { |
|
1221
|
|
|
for (var i = 0; i < this._triggerArray.length; i++) { |
|
1222
|
|
|
var trigger = this._triggerArray[i]; |
|
1223
|
|
|
var selector = Util.getSelectorFromElement(trigger); |
|
1224
|
|
|
|
|
1225
|
|
|
if (selector !== null) { |
|
1226
|
|
|
var $elem = $$$1(selector); |
|
1227
|
|
|
|
|
1228
|
|
|
if (!$elem.hasClass(ClassName.SHOW)) { |
|
1229
|
|
|
$$$1(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false); |
|
1230
|
|
|
} |
|
1231
|
|
|
} |
|
1232
|
|
|
} |
|
1233
|
|
|
} |
|
1234
|
|
|
|
|
1235
|
|
|
this.setTransitioning(true); |
|
1236
|
|
|
|
|
1237
|
|
|
var complete = function complete() { |
|
1238
|
|
|
_this2.setTransitioning(false); |
|
1239
|
|
|
|
|
1240
|
|
|
$$$1(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN); |
|
1241
|
|
|
}; |
|
1242
|
|
|
|
|
1243
|
|
|
this._element.style[dimension] = ''; |
|
1244
|
|
|
|
|
1245
|
|
|
if (!Util.supportsTransitionEnd()) { |
|
1246
|
|
|
complete(); |
|
1247
|
|
|
return; |
|
1248
|
|
|
} |
|
1249
|
|
|
|
|
1250
|
|
|
$$$1(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); |
|
1251
|
|
|
}; |
|
1252
|
|
|
|
|
1253
|
|
|
_proto.setTransitioning = function setTransitioning(isTransitioning) { |
|
1254
|
|
|
this._isTransitioning = isTransitioning; |
|
1255
|
|
|
}; |
|
1256
|
|
|
|
|
1257
|
|
|
_proto.dispose = function dispose() { |
|
1258
|
|
|
$$$1.removeData(this._element, DATA_KEY); |
|
1259
|
|
|
this._config = null; |
|
1260
|
|
|
this._parent = null; |
|
1261
|
|
|
this._element = null; |
|
1262
|
|
|
this._triggerArray = null; |
|
1263
|
|
|
this._isTransitioning = null; |
|
1264
|
|
|
}; // Private |
|
1265
|
|
|
|
|
1266
|
|
|
|
|
1267
|
|
|
_proto._getConfig = function _getConfig(config) { |
|
1268
|
|
|
config = _extends({}, Default, config); |
|
1269
|
|
|
config.toggle = Boolean(config.toggle); // Coerce string values |
|
1270
|
|
|
|
|
1271
|
|
|
Util.typeCheckConfig(NAME, config, DefaultType); |
|
1272
|
|
|
return config; |
|
1273
|
|
|
}; |
|
1274
|
|
|
|
|
1275
|
|
|
_proto._getDimension = function _getDimension() { |
|
1276
|
|
|
var hasWidth = $$$1(this._element).hasClass(Dimension.WIDTH); |
|
1277
|
|
|
return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; |
|
1278
|
|
|
}; |
|
1279
|
|
|
|
|
1280
|
|
|
_proto._getParent = function _getParent() { |
|
1281
|
|
|
var _this3 = this; |
|
1282
|
|
|
|
|
1283
|
|
|
var parent = null; |
|
1284
|
|
|
|
|
1285
|
|
|
if (Util.isElement(this._config.parent)) { |
|
1286
|
|
|
parent = this._config.parent; // It's a jQuery object |
|
1287
|
|
|
|
|
1288
|
|
|
if (typeof this._config.parent.jquery !== 'undefined') { |
|
1289
|
|
|
parent = this._config.parent[0]; |
|
1290
|
|
|
} |
|
1291
|
|
|
} else { |
|
1292
|
|
|
parent = $$$1(this._config.parent)[0]; |
|
1293
|
|
|
} |
|
1294
|
|
|
|
|
1295
|
|
|
var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; |
|
1296
|
|
|
$$$1(parent).find(selector).each(function (i, element) { |
|
1297
|
|
|
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); |
|
1298
|
|
|
}); |
|
1299
|
|
|
return parent; |
|
1300
|
|
|
}; |
|
1301
|
|
|
|
|
1302
|
|
|
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { |
|
1303
|
|
|
if (element) { |
|
1304
|
|
|
var isOpen = $$$1(element).hasClass(ClassName.SHOW); |
|
1305
|
|
|
|
|
1306
|
|
|
if (triggerArray.length > 0) { |
|
1307
|
|
|
$$$1(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); |
|
1308
|
|
|
} |
|
1309
|
|
|
} |
|
1310
|
|
|
}; // Static |
|
1311
|
|
|
|
|
1312
|
|
|
|
|
1313
|
|
|
Collapse._getTargetFromElement = function _getTargetFromElement(element) { |
|
1314
|
|
|
var selector = Util.getSelectorFromElement(element); |
|
1315
|
|
|
return selector ? $$$1(selector)[0] : null; |
|
1316
|
|
|
}; |
|
1317
|
|
|
|
|
1318
|
|
|
Collapse._jQueryInterface = function _jQueryInterface(config) { |
|
1319
|
|
|
return this.each(function () { |
|
1320
|
|
|
var $this = $$$1(this); |
|
1321
|
|
|
var data = $this.data(DATA_KEY); |
|
1322
|
|
|
|
|
1323
|
|
|
var _config = _extends({}, Default, $this.data(), typeof config === 'object' && config); |
|
1324
|
|
|
|
|
1325
|
|
|
if (!data && _config.toggle && /show|hide/.test(config)) { |
|
1326
|
|
|
_config.toggle = false; |
|
1327
|
|
|
} |
|
1328
|
|
|
|
|
1329
|
|
|
if (!data) { |
|
1330
|
|
|
data = new Collapse(this, _config); |
|
1331
|
|
|
$this.data(DATA_KEY, data); |
|
1332
|
|
|
} |
|
1333
|
|
|
|
|
1334
|
|
|
if (typeof config === 'string') { |
|
1335
|
|
|
if (typeof data[config] === 'undefined') { |
|
1336
|
|
|
throw new TypeError("No method named \"" + config + "\""); |
|
1337
|
|
|
} |
|
1338
|
|
|
|
|
1339
|
|
|
data[config](); |
|
1340
|
|
|
} |
|
1341
|
|
|
}); |
|
1342
|
|
|
}; |
|
1343
|
|
|
|
|
1344
|
|
|
_createClass(Collapse, null, [{ |
|
1345
|
|
|
key: "VERSION", |
|
1346
|
|
|
get: function get() { |
|
1347
|
|
|
return VERSION; |
|
1348
|
|
|
} |
|
1349
|
|
|
}, { |
|
1350
|
|
|
key: "Default", |
|
1351
|
|
|
get: function get() { |
|
1352
|
|
|
return Default; |
|
1353
|
|
|
} |
|
1354
|
|
|
}]); |
|
1355
|
|
|
return Collapse; |
|
1356
|
|
|
}(); |
|
1357
|
|
|
/** |
|
1358
|
|
|
* ------------------------------------------------------------------------ |
|
1359
|
|
|
* Data Api implementation |
|
1360
|
|
|
* ------------------------------------------------------------------------ |
|
1361
|
|
|
*/ |
|
1362
|
|
|
|
|
1363
|
|
|
|
|
1364
|
|
|
$$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { |
|
1365
|
|
|
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element |
|
1366
|
|
|
if (event.currentTarget.tagName === 'A') { |
|
1367
|
|
|
event.preventDefault(); |
|
1368
|
|
|
} |
|
1369
|
|
|
|
|
1370
|
|
|
var $trigger = $$$1(this); |
|
1371
|
|
|
var selector = Util.getSelectorFromElement(this); |
|
1372
|
|
|
$$$1(selector).each(function () { |
|
1373
|
|
|
var $target = $$$1(this); |
|
1374
|
|
|
var data = $target.data(DATA_KEY); |
|
1375
|
|
|
var config = data ? 'toggle' : $trigger.data(); |
|
1376
|
|
|
|
|
1377
|
|
|
Collapse._jQueryInterface.call($target, config); |
|
1378
|
|
|
}); |
|
1379
|
|
|
}); |
|
1380
|
|
|
/** |
|
1381
|
|
|
* ------------------------------------------------------------------------ |
|
1382
|
|
|
* jQuery |
|
1383
|
|
|
* ------------------------------------------------------------------------ |
|
1384
|
|
|
*/ |
|
1385
|
|
|
|
|
1386
|
|
|
$$$1.fn[NAME] = Collapse._jQueryInterface; |
|
1387
|
|
|
$$$1.fn[NAME].Constructor = Collapse; |
|
1388
|
|
|
|
|
1389
|
|
|
$$$1.fn[NAME].noConflict = function () { |
|
1390
|
|
|
$$$1.fn[NAME] = JQUERY_NO_CONFLICT; |
|
1391
|
|
|
return Collapse._jQueryInterface; |
|
1392
|
|
|
}; |
|
1393
|
|
|
|
|
1394
|
|
|
return Collapse; |
|
1395
|
|
|
}($); |
|
1396
|
|
|
|
|
1397
|
|
|
/**! |
|
1398
|
|
|
* @fileOverview Kickass library to create and place poppers near their reference elements. |
|
1399
|
|
|
* @version 1.12.9 |
|
1400
|
|
|
* @license |
|
1401
|
|
|
* Copyright (c) 2016 Federico Zivolo and contributors |
|
1402
|
|
|
* |
|
1403
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
1404
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
|
1405
|
|
|
* in the Software without restriction, including without limitation the rights |
|
1406
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
1407
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
|
1408
|
|
|
* furnished to do so, subject to the following conditions: |
|
1409
|
|
|
* |
|
1410
|
|
|
* The above copyright notice and this permission notice shall be included in all |
|
1411
|
|
|
* copies or substantial portions of the Software. |
|
1412
|
|
|
* |
|
1413
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
1414
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
1415
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
1416
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
1417
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
1418
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
1419
|
|
|
* SOFTWARE. |
|
1420
|
|
|
*/ |
|
1421
|
|
|
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'; |
|
1422
|
|
|
var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; |
|
1423
|
|
|
var timeoutDuration = 0; |
|
1424
|
|
|
for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { |
|
1425
|
|
|
if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { |
|
|
|
|
|
|
1426
|
|
|
timeoutDuration = 1; |
|
1427
|
|
|
break; |
|
1428
|
|
|
} |
|
1429
|
|
|
} |
|
1430
|
|
|
|
|
1431
|
|
|
function microtaskDebounce(fn) { |
|
1432
|
|
|
var called = false; |
|
1433
|
|
|
return function () { |
|
1434
|
|
|
if (called) { |
|
1435
|
|
|
return; |
|
1436
|
|
|
} |
|
1437
|
|
|
called = true; |
|
1438
|
|
|
window.Promise.resolve().then(function () { |
|
1439
|
|
|
called = false; |
|
1440
|
|
|
fn(); |
|
1441
|
|
|
}); |
|
1442
|
|
|
}; |
|
1443
|
|
|
} |
|
1444
|
|
|
|
|
1445
|
|
|
function taskDebounce(fn) { |
|
1446
|
|
|
var scheduled = false; |
|
1447
|
|
|
return function () { |
|
1448
|
|
|
if (!scheduled) { |
|
1449
|
|
|
scheduled = true; |
|
1450
|
|
|
setTimeout(function () { |
|
1451
|
|
|
scheduled = false; |
|
1452
|
|
|
fn(); |
|
1453
|
|
|
}, timeoutDuration); |
|
1454
|
|
|
} |
|
1455
|
|
|
}; |
|
1456
|
|
|
} |
|
1457
|
|
|
|
|
1458
|
|
|
var supportsMicroTasks = isBrowser && window.Promise; |
|
1459
|
|
|
|
|
1460
|
|
|
/** |
|
1461
|
|
|
* Create a debounced version of a method, that's asynchronously deferred |
|
1462
|
|
|
* but called in the minimum time possible. |
|
1463
|
|
|
* |
|
1464
|
|
|
* @method |
|
1465
|
|
|
* @memberof Popper.Utils |
|
1466
|
|
|
* @argument {Function} fn |
|
1467
|
|
|
* @returns {Function} |
|
1468
|
|
|
*/ |
|
1469
|
|
|
var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; |
|
1470
|
|
|
|
|
1471
|
|
|
/** |
|
1472
|
|
|
* Check if the given variable is a function |
|
1473
|
|
|
* @method |
|
1474
|
|
|
* @memberof Popper.Utils |
|
1475
|
|
|
* @argument {Any} functionToCheck - variable to check |
|
1476
|
|
|
* @returns {Boolean} answer to: is a function? |
|
1477
|
|
|
*/ |
|
1478
|
|
|
function isFunction(functionToCheck) { |
|
1479
|
|
|
var getType = {}; |
|
1480
|
|
|
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; |
|
1481
|
|
|
} |
|
1482
|
|
|
|
|
1483
|
|
|
/** |
|
1484
|
|
|
* Get CSS computed property of the given element |
|
1485
|
|
|
* @method |
|
1486
|
|
|
* @memberof Popper.Utils |
|
1487
|
|
|
* @argument {Eement} element |
|
1488
|
|
|
* @argument {String} property |
|
1489
|
|
|
*/ |
|
1490
|
|
|
function getStyleComputedProperty(element, property) { |
|
1491
|
|
|
if (element.nodeType !== 1) { |
|
1492
|
|
|
return []; |
|
1493
|
|
|
} |
|
1494
|
|
|
// NOTE: 1 DOM access here |
|
1495
|
|
|
var css = getComputedStyle(element, null); |
|
1496
|
|
|
return property ? css[property] : css; |
|
1497
|
|
|
} |
|
1498
|
|
|
|
|
1499
|
|
|
/** |
|
1500
|
|
|
* Returns the parentNode or the host of the element |
|
1501
|
|
|
* @method |
|
1502
|
|
|
* @memberof Popper.Utils |
|
1503
|
|
|
* @argument {Element} element |
|
1504
|
|
|
* @returns {Element} parent |
|
1505
|
|
|
*/ |
|
1506
|
|
|
function getParentNode(element) { |
|
1507
|
|
|
if (element.nodeName === 'HTML') { |
|
1508
|
|
|
return element; |
|
1509
|
|
|
} |
|
1510
|
|
|
return element.parentNode || element.host; |
|
1511
|
|
|
} |
|
1512
|
|
|
|
|
1513
|
|
|
/** |
|
1514
|
|
|
* Returns the scrolling parent of the given element |
|
1515
|
|
|
* @method |
|
1516
|
|
|
* @memberof Popper.Utils |
|
1517
|
|
|
* @argument {Element} element |
|
1518
|
|
|
* @returns {Element} scroll parent |
|
1519
|
|
|
*/ |
|
1520
|
|
|
function getScrollParent(element) { |
|
1521
|
|
|
// Return body, `getScroll` will take care to get the correct `scrollTop` from it |
|
1522
|
|
|
if (!element) { |
|
1523
|
|
|
return document.body; |
|
1524
|
|
|
} |
|
1525
|
|
|
|
|
1526
|
|
|
switch (element.nodeName) { |
|
1527
|
|
|
case 'HTML': |
|
1528
|
|
|
case 'BODY': |
|
1529
|
|
|
return element.ownerDocument.body; |
|
1530
|
|
|
case '#document': |
|
1531
|
|
|
return element.body; |
|
1532
|
|
|
} |
|
1533
|
|
|
|
|
1534
|
|
|
// Firefox want us to check `-x` and `-y` variations as well |
|
1535
|
|
|
|
|
1536
|
|
|
var _getStyleComputedProp = getStyleComputedProperty(element), |
|
1537
|
|
|
overflow = _getStyleComputedProp.overflow, |
|
1538
|
|
|
overflowX = _getStyleComputedProp.overflowX, |
|
1539
|
|
|
overflowY = _getStyleComputedProp.overflowY; |
|
1540
|
|
|
|
|
1541
|
|
|
if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) { |
|
1542
|
|
|
return element; |
|
1543
|
|
|
} |
|
1544
|
|
|
|
|
1545
|
|
|
return getScrollParent(getParentNode(element)); |
|
1546
|
|
|
} |
|
1547
|
|
|
|
|
1548
|
|
|
/** |
|
1549
|
|
|
* Returns the offset parent of the given element |
|
1550
|
|
|
* @method |
|
1551
|
|
|
* @memberof Popper.Utils |
|
1552
|
|
|
* @argument {Element} element |
|
1553
|
|
|
* @returns {Element} offset parent |
|
1554
|
|
|
*/ |
|
1555
|
|
|
function getOffsetParent(element) { |
|
1556
|
|
|
// NOTE: 1 DOM access here |
|
1557
|
|
|
var offsetParent = element && element.offsetParent; |
|
1558
|
|
|
var nodeName = offsetParent && offsetParent.nodeName; |
|
1559
|
|
|
|
|
1560
|
|
|
if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { |
|
1561
|
|
|
if (element) { |
|
1562
|
|
|
return element.ownerDocument.documentElement; |
|
1563
|
|
|
} |
|
1564
|
|
|
|
|
1565
|
|
|
return document.documentElement; |
|
1566
|
|
|
} |
|
1567
|
|
|
|
|
1568
|
|
|
// .offsetParent will return the closest TD or TABLE in case |
|
1569
|
|
|
// no offsetParent is present, I hate this job... |
|
1570
|
|
|
if (['TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { |
|
1571
|
|
|
return getOffsetParent(offsetParent); |
|
1572
|
|
|
} |
|
1573
|
|
|
|
|
1574
|
|
|
return offsetParent; |
|
1575
|
|
|
} |
|
1576
|
|
|
|
|
1577
|
|
|
function isOffsetContainer(element) { |
|
1578
|
|
|
var nodeName = element.nodeName; |
|
1579
|
|
|
|
|
1580
|
|
|
if (nodeName === 'BODY') { |
|
1581
|
|
|
return false; |
|
1582
|
|
|
} |
|
1583
|
|
|
return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; |
|
1584
|
|
|
} |
|
1585
|
|
|
|
|
1586
|
|
|
/** |
|
1587
|
|
|
* Finds the root node (document, shadowDOM root) of the given element |
|
1588
|
|
|
* @method |
|
1589
|
|
|
* @memberof Popper.Utils |
|
1590
|
|
|
* @argument {Element} node |
|
1591
|
|
|
* @returns {Element} root node |
|
1592
|
|
|
*/ |
|
1593
|
|
|
function getRoot(node) { |
|
1594
|
|
|
if (node.parentNode !== null) { |
|
1595
|
|
|
return getRoot(node.parentNode); |
|
1596
|
|
|
} |
|
1597
|
|
|
|
|
1598
|
|
|
return node; |
|
1599
|
|
|
} |
|
1600
|
|
|
|
|
1601
|
|
|
/** |
|
1602
|
|
|
* Finds the offset parent common to the two provided nodes |
|
1603
|
|
|
* @method |
|
1604
|
|
|
* @memberof Popper.Utils |
|
1605
|
|
|
* @argument {Element} element1 |
|
1606
|
|
|
* @argument {Element} element2 |
|
1607
|
|
|
* @returns {Element} common offset parent |
|
1608
|
|
|
*/ |
|
1609
|
|
|
function findCommonOffsetParent(element1, element2) { |
|
1610
|
|
|
// This check is needed to avoid errors in case one of the elements isn't defined for any reason |
|
1611
|
|
|
if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { |
|
1612
|
|
|
return document.documentElement; |
|
1613
|
|
|
} |
|
1614
|
|
|
|
|
1615
|
|
|
// Here we make sure to give as "start" the element that comes first in the DOM |
|
1616
|
|
|
var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; |
|
|
|
|
|
|
1617
|
|
|
var start = order ? element1 : element2; |
|
1618
|
|
|
var end = order ? element2 : element1; |
|
1619
|
|
|
|
|
1620
|
|
|
// Get common ancestor container |
|
1621
|
|
|
var range = document.createRange(); |
|
1622
|
|
|
range.setStart(start, 0); |
|
1623
|
|
|
range.setEnd(end, 0); |
|
1624
|
|
|
var commonAncestorContainer = range.commonAncestorContainer; |
|
1625
|
|
|
|
|
1626
|
|
|
// Both nodes are inside #document |
|
1627
|
|
|
|
|
1628
|
|
|
if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { |
|
1629
|
|
|
if (isOffsetContainer(commonAncestorContainer)) { |
|
1630
|
|
|
return commonAncestorContainer; |
|
1631
|
|
|
} |
|
1632
|
|
|
|
|
1633
|
|
|
return getOffsetParent(commonAncestorContainer); |
|
1634
|
|
|
} |
|
1635
|
|
|
|
|
1636
|
|
|
// one of the nodes is inside shadowDOM, find which one |
|
1637
|
|
|
var element1root = getRoot(element1); |
|
1638
|
|
|
if (element1root.host) { |
|
1639
|
|
|
return findCommonOffsetParent(element1root.host, element2); |
|
1640
|
|
|
} else { |
|
|
|
|
|
|
1641
|
|
|
return findCommonOffsetParent(element1, getRoot(element2).host); |
|
1642
|
|
|
} |
|
1643
|
|
|
} |
|
1644
|
|
|
|
|
1645
|
|
|
/** |
|
1646
|
|
|
* Gets the scroll value of the given element in the given side (top and left) |
|
1647
|
|
|
* @method |
|
1648
|
|
|
* @memberof Popper.Utils |
|
1649
|
|
|
* @argument {Element} element |
|
1650
|
|
|
* @argument {String} side `top` or `left` |
|
1651
|
|
|
* @returns {number} amount of scrolled pixels |
|
1652
|
|
|
*/ |
|
1653
|
|
|
function getScroll(element) { |
|
1654
|
|
|
var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; |
|
1655
|
|
|
|
|
1656
|
|
|
var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; |
|
1657
|
|
|
var nodeName = element.nodeName; |
|
1658
|
|
|
|
|
1659
|
|
|
if (nodeName === 'BODY' || nodeName === 'HTML') { |
|
1660
|
|
|
var html = element.ownerDocument.documentElement; |
|
1661
|
|
|
var scrollingElement = element.ownerDocument.scrollingElement || html; |
|
1662
|
|
|
return scrollingElement[upperSide]; |
|
1663
|
|
|
} |
|
1664
|
|
|
|
|
1665
|
|
|
return element[upperSide]; |
|
1666
|
|
|
} |
|
1667
|
|
|
|
|
1668
|
|
|
/* |
|
1669
|
|
|
* Sum or subtract the element scroll values (left and top) from a given rect object |
|
1670
|
|
|
* @method |
|
1671
|
|
|
* @memberof Popper.Utils |
|
1672
|
|
|
* @param {Object} rect - Rect object you want to change |
|
1673
|
|
|
* @param {HTMLElement} element - The element from the function reads the scroll values |
|
1674
|
|
|
* @param {Boolean} subtract - set to true if you want to subtract the scroll values |
|
1675
|
|
|
* @return {Object} rect - The modifier rect object |
|
1676
|
|
|
*/ |
|
1677
|
|
|
function includeScroll(rect, element) { |
|
1678
|
|
|
var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; |
|
1679
|
|
|
|
|
1680
|
|
|
var scrollTop = getScroll(element, 'top'); |
|
1681
|
|
|
var scrollLeft = getScroll(element, 'left'); |
|
1682
|
|
|
var modifier = subtract ? -1 : 1; |
|
1683
|
|
|
rect.top += scrollTop * modifier; |
|
1684
|
|
|
rect.bottom += scrollTop * modifier; |
|
1685
|
|
|
rect.left += scrollLeft * modifier; |
|
1686
|
|
|
rect.right += scrollLeft * modifier; |
|
1687
|
|
|
return rect; |
|
1688
|
|
|
} |
|
1689
|
|
|
|
|
1690
|
|
|
/* |
|
1691
|
|
|
* Helper to detect borders of a given element |
|
1692
|
|
|
* @method |
|
1693
|
|
|
* @memberof Popper.Utils |
|
1694
|
|
|
* @param {CSSStyleDeclaration} styles |
|
1695
|
|
|
* Result of `getStyleComputedProperty` on the given element |
|
1696
|
|
|
* @param {String} axis - `x` or `y` |
|
1697
|
|
|
* @return {number} borders - The borders size of the given axis |
|
1698
|
|
|
*/ |
|
1699
|
|
|
|
|
1700
|
|
|
function getBordersSize(styles, axis) { |
|
1701
|
|
|
var sideA = axis === 'x' ? 'Left' : 'Top'; |
|
1702
|
|
|
var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; |
|
1703
|
|
|
|
|
1704
|
|
|
return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10); |
|
1705
|
|
|
} |
|
1706
|
|
|
|
|
1707
|
|
|
/** |
|
1708
|
|
|
* Tells if you are running Internet Explorer 10 |
|
1709
|
|
|
* @method |
|
1710
|
|
|
* @memberof Popper.Utils |
|
1711
|
|
|
* @returns {Boolean} isIE10 |
|
1712
|
|
|
*/ |
|
1713
|
|
|
var isIE10 = undefined; |
|
|
|
|
|
|
1714
|
|
|
|
|
1715
|
|
|
var isIE10$1 = function () { |
|
1716
|
|
|
if (isIE10 === undefined) { |
|
1717
|
|
|
isIE10 = navigator.appVersion.indexOf('MSIE 10') !== -1; |
|
|
|
|
|
|
1718
|
|
|
} |
|
1719
|
|
|
return isIE10; |
|
1720
|
|
|
}; |
|
1721
|
|
|
|
|
1722
|
|
|
function getSize(axis, body, html, computedStyle) { |
|
1723
|
|
|
return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE10$1() ? html['offset' + axis] + computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')] + computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')] : 0); |
|
1724
|
|
|
} |
|
1725
|
|
|
|
|
1726
|
|
|
function getWindowSizes() { |
|
1727
|
|
|
var body = document.body; |
|
1728
|
|
|
var html = document.documentElement; |
|
1729
|
|
|
var computedStyle = isIE10$1() && getComputedStyle(html); |
|
1730
|
|
|
|
|
1731
|
|
|
return { |
|
1732
|
|
|
height: getSize('Height', body, html, computedStyle), |
|
1733
|
|
|
width: getSize('Width', body, html, computedStyle) |
|
1734
|
|
|
}; |
|
1735
|
|
|
} |
|
1736
|
|
|
|
|
1737
|
|
|
var classCallCheck = function (instance, Constructor) { |
|
1738
|
|
|
if (!(instance instanceof Constructor)) { |
|
1739
|
|
|
throw new TypeError("Cannot call a class as a function"); |
|
1740
|
|
|
} |
|
1741
|
|
|
}; |
|
1742
|
|
|
|
|
1743
|
|
|
var createClass = function () { |
|
1744
|
|
|
function defineProperties(target, props) { |
|
1745
|
|
|
for (var i = 0; i < props.length; i++) { |
|
1746
|
|
|
var descriptor = props[i]; |
|
1747
|
|
|
descriptor.enumerable = descriptor.enumerable || false; |
|
1748
|
|
|
descriptor.configurable = true; |
|
1749
|
|
|
if ("value" in descriptor) descriptor.writable = true; |
|
1750
|
|
|
Object.defineProperty(target, descriptor.key, descriptor); |
|
1751
|
|
|
} |
|
1752
|
|
|
} |
|
1753
|
|
|
|
|
1754
|
|
|
return function (Constructor, protoProps, staticProps) { |
|
1755
|
|
|
if (protoProps) defineProperties(Constructor.prototype, protoProps); |
|
1756
|
|
|
if (staticProps) defineProperties(Constructor, staticProps); |
|
1757
|
|
|
return Constructor; |
|
1758
|
|
|
}; |
|
1759
|
|
|
}(); |
|
1760
|
|
|
|
|
1761
|
|
|
|
|
1762
|
|
|
|
|
1763
|
|
|
|
|
1764
|
|
|
|
|
1765
|
|
|
var defineProperty = function (obj, key, value) { |
|
1766
|
|
|
if (key in obj) { |
|
1767
|
|
|
Object.defineProperty(obj, key, { |
|
1768
|
|
|
value: value, |
|
1769
|
|
|
enumerable: true, |
|
1770
|
|
|
configurable: true, |
|
1771
|
|
|
writable: true |
|
1772
|
|
|
}); |
|
1773
|
|
|
} else { |
|
1774
|
|
|
obj[key] = value; |
|
1775
|
|
|
} |
|
1776
|
|
|
|
|
1777
|
|
|
return obj; |
|
1778
|
|
|
}; |
|
1779
|
|
|
|
|
1780
|
|
|
var _extends$1 = Object.assign || function (target) { |
|
1781
|
|
|
for (var i = 1; i < arguments.length; i++) { |
|
1782
|
|
|
var source = arguments[i]; |
|
1783
|
|
|
|
|
1784
|
|
|
for (var key in source) { |
|
|
|
|
|
|
1785
|
|
|
if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
1786
|
|
|
target[key] = source[key]; |
|
1787
|
|
|
} |
|
1788
|
|
|
} |
|
1789
|
|
|
} |
|
1790
|
|
|
|
|
1791
|
|
|
return target; |
|
1792
|
|
|
}; |
|
1793
|
|
|
|
|
1794
|
|
|
/** |
|
1795
|
|
|
* Given element offsets, generate an output similar to getBoundingClientRect |
|
1796
|
|
|
* @method |
|
1797
|
|
|
* @memberof Popper.Utils |
|
1798
|
|
|
* @argument {Object} offsets |
|
1799
|
|
|
* @returns {Object} ClientRect like output |
|
1800
|
|
|
*/ |
|
1801
|
|
|
function getClientRect(offsets) { |
|
1802
|
|
|
return _extends$1({}, offsets, { |
|
1803
|
|
|
right: offsets.left + offsets.width, |
|
1804
|
|
|
bottom: offsets.top + offsets.height |
|
1805
|
|
|
}); |
|
1806
|
|
|
} |
|
1807
|
|
|
|
|
1808
|
|
|
/** |
|
1809
|
|
|
* Get bounding client rect of given element |
|
1810
|
|
|
* @method |
|
1811
|
|
|
* @memberof Popper.Utils |
|
1812
|
|
|
* @param {HTMLElement} element |
|
1813
|
|
|
* @return {Object} client rect |
|
1814
|
|
|
*/ |
|
1815
|
|
|
function getBoundingClientRect(element) { |
|
1816
|
|
|
var rect = {}; |
|
|
|
|
|
|
1817
|
|
|
|
|
1818
|
|
|
// IE10 10 FIX: Please, don't ask, the element isn't |
|
1819
|
|
|
// considered in DOM in some circumstances... |
|
1820
|
|
|
// This isn't reproducible in IE10 compatibility mode of IE11 |
|
1821
|
|
|
if (isIE10$1()) { |
|
1822
|
|
|
try { |
|
1823
|
|
|
rect = element.getBoundingClientRect(); |
|
1824
|
|
|
var scrollTop = getScroll(element, 'top'); |
|
1825
|
|
|
var scrollLeft = getScroll(element, 'left'); |
|
1826
|
|
|
rect.top += scrollTop; |
|
1827
|
|
|
rect.left += scrollLeft; |
|
1828
|
|
|
rect.bottom += scrollTop; |
|
1829
|
|
|
rect.right += scrollLeft; |
|
1830
|
|
|
} catch (err) {} |
|
|
|
|
|
|
1831
|
|
|
} else { |
|
1832
|
|
|
rect = element.getBoundingClientRect(); |
|
1833
|
|
|
} |
|
1834
|
|
|
|
|
1835
|
|
|
var result = { |
|
1836
|
|
|
left: rect.left, |
|
1837
|
|
|
top: rect.top, |
|
1838
|
|
|
width: rect.right - rect.left, |
|
1839
|
|
|
height: rect.bottom - rect.top |
|
1840
|
|
|
}; |
|
1841
|
|
|
|
|
1842
|
|
|
// subtract scrollbar size from sizes |
|
1843
|
|
|
var sizes = element.nodeName === 'HTML' ? getWindowSizes() : {}; |
|
1844
|
|
|
var width = sizes.width || element.clientWidth || result.right - result.left; |
|
1845
|
|
|
var height = sizes.height || element.clientHeight || result.bottom - result.top; |
|
1846
|
|
|
|
|
1847
|
|
|
var horizScrollbar = element.offsetWidth - width; |
|
1848
|
|
|
var vertScrollbar = element.offsetHeight - height; |
|
1849
|
|
|
|
|
1850
|
|
|
// if an hypothetical scrollbar is detected, we must be sure it's not a `border` |
|
1851
|
|
|
// we make this check conditional for performance reasons |
|
1852
|
|
|
if (horizScrollbar || vertScrollbar) { |
|
1853
|
|
|
var styles = getStyleComputedProperty(element); |
|
1854
|
|
|
horizScrollbar -= getBordersSize(styles, 'x'); |
|
1855
|
|
|
vertScrollbar -= getBordersSize(styles, 'y'); |
|
1856
|
|
|
|
|
1857
|
|
|
result.width -= horizScrollbar; |
|
1858
|
|
|
result.height -= vertScrollbar; |
|
1859
|
|
|
} |
|
1860
|
|
|
|
|
1861
|
|
|
return getClientRect(result); |
|
1862
|
|
|
} |
|
1863
|
|
|
|
|
1864
|
|
|
function getOffsetRectRelativeToArbitraryNode(children, parent) { |
|
1865
|
|
|
var isIE10 = isIE10$1(); |
|
1866
|
|
|
var isHTML = parent.nodeName === 'HTML'; |
|
1867
|
|
|
var childrenRect = getBoundingClientRect(children); |
|
1868
|
|
|
var parentRect = getBoundingClientRect(parent); |
|
1869
|
|
|
var scrollParent = getScrollParent(children); |
|
1870
|
|
|
|
|
1871
|
|
|
var styles = getStyleComputedProperty(parent); |
|
1872
|
|
|
var borderTopWidth = parseFloat(styles.borderTopWidth, 10); |
|
1873
|
|
|
var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10); |
|
1874
|
|
|
|
|
1875
|
|
|
var offsets = getClientRect({ |
|
1876
|
|
|
top: childrenRect.top - parentRect.top - borderTopWidth, |
|
1877
|
|
|
left: childrenRect.left - parentRect.left - borderLeftWidth, |
|
1878
|
|
|
width: childrenRect.width, |
|
1879
|
|
|
height: childrenRect.height |
|
1880
|
|
|
}); |
|
1881
|
|
|
offsets.marginTop = 0; |
|
1882
|
|
|
offsets.marginLeft = 0; |
|
1883
|
|
|
|
|
1884
|
|
|
// Subtract margins of documentElement in case it's being used as parent |
|
1885
|
|
|
// we do this only on HTML because it's the only element that behaves |
|
1886
|
|
|
// differently when margins are applied to it. The margins are included in |
|
1887
|
|
|
// the box of the documentElement, in the other cases not. |
|
1888
|
|
|
if (!isIE10 && isHTML) { |
|
1889
|
|
|
var marginTop = parseFloat(styles.marginTop, 10); |
|
1890
|
|
|
var marginLeft = parseFloat(styles.marginLeft, 10); |
|
1891
|
|
|
|
|
1892
|
|
|
offsets.top -= borderTopWidth - marginTop; |
|
1893
|
|
|
offsets.bottom -= borderTopWidth - marginTop; |
|
1894
|
|
|
offsets.left -= borderLeftWidth - marginLeft; |
|
1895
|
|
|
offsets.right -= borderLeftWidth - marginLeft; |
|
1896
|
|
|
|
|
1897
|
|
|
// Attach marginTop and marginLeft because in some circumstances we may need them |
|
1898
|
|
|
offsets.marginTop = marginTop; |
|
1899
|
|
|
offsets.marginLeft = marginLeft; |
|
1900
|
|
|
} |
|
1901
|
|
|
|
|
1902
|
|
|
if (isIE10 ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { |
|
1903
|
|
|
offsets = includeScroll(offsets, parent); |
|
1904
|
|
|
} |
|
1905
|
|
|
|
|
1906
|
|
|
return offsets; |
|
1907
|
|
|
} |
|
1908
|
|
|
|
|
1909
|
|
|
function getViewportOffsetRectRelativeToArtbitraryNode(element) { |
|
1910
|
|
|
var html = element.ownerDocument.documentElement; |
|
1911
|
|
|
var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); |
|
1912
|
|
|
var width = Math.max(html.clientWidth, window.innerWidth || 0); |
|
1913
|
|
|
var height = Math.max(html.clientHeight, window.innerHeight || 0); |
|
1914
|
|
|
|
|
1915
|
|
|
var scrollTop = getScroll(html); |
|
1916
|
|
|
var scrollLeft = getScroll(html, 'left'); |
|
1917
|
|
|
|
|
1918
|
|
|
var offset = { |
|
1919
|
|
|
top: scrollTop - relativeOffset.top + relativeOffset.marginTop, |
|
1920
|
|
|
left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, |
|
1921
|
|
|
width: width, |
|
1922
|
|
|
height: height |
|
1923
|
|
|
}; |
|
1924
|
|
|
|
|
1925
|
|
|
return getClientRect(offset); |
|
1926
|
|
|
} |
|
1927
|
|
|
|
|
1928
|
|
|
/** |
|
1929
|
|
|
* Check if the given element is fixed or is inside a fixed parent |
|
1930
|
|
|
* @method |
|
1931
|
|
|
* @memberof Popper.Utils |
|
1932
|
|
|
* @argument {Element} element |
|
1933
|
|
|
* @argument {Element} customContainer |
|
1934
|
|
|
* @returns {Boolean} answer to "isFixed?" |
|
1935
|
|
|
*/ |
|
1936
|
|
|
function isFixed(element) { |
|
1937
|
|
|
var nodeName = element.nodeName; |
|
1938
|
|
|
if (nodeName === 'BODY' || nodeName === 'HTML') { |
|
1939
|
|
|
return false; |
|
1940
|
|
|
} |
|
1941
|
|
|
if (getStyleComputedProperty(element, 'position') === 'fixed') { |
|
1942
|
|
|
return true; |
|
1943
|
|
|
} |
|
1944
|
|
|
return isFixed(getParentNode(element)); |
|
1945
|
|
|
} |
|
1946
|
|
|
|
|
1947
|
|
|
/** |
|
1948
|
|
|
* Computed the boundaries limits and return them |
|
1949
|
|
|
* @method |
|
1950
|
|
|
* @memberof Popper.Utils |
|
1951
|
|
|
* @param {HTMLElement} popper |
|
1952
|
|
|
* @param {HTMLElement} reference |
|
1953
|
|
|
* @param {number} padding |
|
1954
|
|
|
* @param {HTMLElement} boundariesElement - Element used to define the boundaries |
|
1955
|
|
|
* @returns {Object} Coordinates of the boundaries |
|
1956
|
|
|
*/ |
|
1957
|
|
|
function getBoundaries(popper, reference, padding, boundariesElement) { |
|
1958
|
|
|
// NOTE: 1 DOM access here |
|
1959
|
|
|
var boundaries = { top: 0, left: 0 }; |
|
1960
|
|
|
var offsetParent = findCommonOffsetParent(popper, reference); |
|
1961
|
|
|
|
|
1962
|
|
|
// Handle viewport case |
|
1963
|
|
|
if (boundariesElement === 'viewport') { |
|
1964
|
|
|
boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent); |
|
1965
|
|
|
} else { |
|
1966
|
|
|
// Handle other cases based on DOM element used as boundaries |
|
1967
|
|
|
var boundariesNode = void 0; |
|
|
|
|
|
|
1968
|
|
|
if (boundariesElement === 'scrollParent') { |
|
1969
|
|
|
boundariesNode = getScrollParent(getParentNode(reference)); |
|
1970
|
|
|
if (boundariesNode.nodeName === 'BODY') { |
|
1971
|
|
|
boundariesNode = popper.ownerDocument.documentElement; |
|
1972
|
|
|
} |
|
1973
|
|
|
} else if (boundariesElement === 'window') { |
|
1974
|
|
|
boundariesNode = popper.ownerDocument.documentElement; |
|
1975
|
|
|
} else { |
|
1976
|
|
|
boundariesNode = boundariesElement; |
|
1977
|
|
|
} |
|
1978
|
|
|
|
|
1979
|
|
|
var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent); |
|
1980
|
|
|
|
|
1981
|
|
|
// In case of HTML, we need a different computation |
|
1982
|
|
|
if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { |
|
1983
|
|
|
var _getWindowSizes = getWindowSizes(), |
|
1984
|
|
|
height = _getWindowSizes.height, |
|
1985
|
|
|
width = _getWindowSizes.width; |
|
1986
|
|
|
|
|
1987
|
|
|
boundaries.top += offsets.top - offsets.marginTop; |
|
1988
|
|
|
boundaries.bottom = height + offsets.top; |
|
1989
|
|
|
boundaries.left += offsets.left - offsets.marginLeft; |
|
1990
|
|
|
boundaries.right = width + offsets.left; |
|
1991
|
|
|
} else { |
|
1992
|
|
|
// for all the other DOM elements, this one is good |
|
1993
|
|
|
boundaries = offsets; |
|
1994
|
|
|
} |
|
1995
|
|
|
} |
|
1996
|
|
|
|
|
1997
|
|
|
// Add paddings |
|
1998
|
|
|
boundaries.left += padding; |
|
1999
|
|
|
boundaries.top += padding; |
|
2000
|
|
|
boundaries.right -= padding; |
|
2001
|
|
|
boundaries.bottom -= padding; |
|
2002
|
|
|
|
|
2003
|
|
|
return boundaries; |
|
2004
|
|
|
} |
|
2005
|
|
|
|
|
2006
|
|
|
function getArea(_ref) { |
|
2007
|
|
|
var width = _ref.width, |
|
2008
|
|
|
height = _ref.height; |
|
2009
|
|
|
|
|
2010
|
|
|
return width * height; |
|
2011
|
|
|
} |
|
2012
|
|
|
|
|
2013
|
|
|
/** |
|
2014
|
|
|
* Utility used to transform the `auto` placement to the placement with more |
|
2015
|
|
|
* available space. |
|
2016
|
|
|
* @method |
|
2017
|
|
|
* @memberof Popper.Utils |
|
2018
|
|
|
* @argument {Object} data - The data object generated by update method |
|
2019
|
|
|
* @argument {Object} options - Modifiers configuration and options |
|
2020
|
|
|
* @returns {Object} The data object, properly modified |
|
2021
|
|
|
*/ |
|
2022
|
|
|
function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { |
|
2023
|
|
|
var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; |
|
2024
|
|
|
|
|
2025
|
|
|
if (placement.indexOf('auto') === -1) { |
|
2026
|
|
|
return placement; |
|
2027
|
|
|
} |
|
2028
|
|
|
|
|
2029
|
|
|
var boundaries = getBoundaries(popper, reference, padding, boundariesElement); |
|
2030
|
|
|
|
|
2031
|
|
|
var rects = { |
|
2032
|
|
|
top: { |
|
2033
|
|
|
width: boundaries.width, |
|
2034
|
|
|
height: refRect.top - boundaries.top |
|
2035
|
|
|
}, |
|
2036
|
|
|
right: { |
|
2037
|
|
|
width: boundaries.right - refRect.right, |
|
2038
|
|
|
height: boundaries.height |
|
2039
|
|
|
}, |
|
2040
|
|
|
bottom: { |
|
2041
|
|
|
width: boundaries.width, |
|
2042
|
|
|
height: boundaries.bottom - refRect.bottom |
|
2043
|
|
|
}, |
|
2044
|
|
|
left: { |
|
2045
|
|
|
width: refRect.left - boundaries.left, |
|
2046
|
|
|
height: boundaries.height |
|
2047
|
|
|
} |
|
2048
|
|
|
}; |
|
2049
|
|
|
|
|
2050
|
|
|
var sortedAreas = Object.keys(rects).map(function (key) { |
|
2051
|
|
|
return _extends$1({ |
|
2052
|
|
|
key: key |
|
2053
|
|
|
}, rects[key], { |
|
2054
|
|
|
area: getArea(rects[key]) |
|
2055
|
|
|
}); |
|
2056
|
|
|
}).sort(function (a, b) { |
|
2057
|
|
|
return b.area - a.area; |
|
2058
|
|
|
}); |
|
2059
|
|
|
|
|
2060
|
|
|
var filteredAreas = sortedAreas.filter(function (_ref2) { |
|
2061
|
|
|
var width = _ref2.width, |
|
2062
|
|
|
height = _ref2.height; |
|
2063
|
|
|
return width >= popper.clientWidth && height >= popper.clientHeight; |
|
2064
|
|
|
}); |
|
2065
|
|
|
|
|
2066
|
|
|
var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; |
|
2067
|
|
|
|
|
2068
|
|
|
var variation = placement.split('-')[1]; |
|
2069
|
|
|
|
|
2070
|
|
|
return computedPlacement + (variation ? '-' + variation : ''); |
|
2071
|
|
|
} |
|
2072
|
|
|
|
|
2073
|
|
|
/** |
|
2074
|
|
|
* Get offsets to the reference element |
|
2075
|
|
|
* @method |
|
2076
|
|
|
* @memberof Popper.Utils |
|
2077
|
|
|
* @param {Object} state |
|
2078
|
|
|
* @param {Element} popper - the popper element |
|
2079
|
|
|
* @param {Element} reference - the reference element (the popper will be relative to this) |
|
2080
|
|
|
* @returns {Object} An object containing the offsets which will be applied to the popper |
|
2081
|
|
|
*/ |
|
2082
|
|
|
function getReferenceOffsets(state, popper, reference) { |
|
2083
|
|
|
var commonOffsetParent = findCommonOffsetParent(popper, reference); |
|
2084
|
|
|
return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent); |
|
2085
|
|
|
} |
|
2086
|
|
|
|
|
2087
|
|
|
/** |
|
2088
|
|
|
* Get the outer sizes of the given element (offset size + margins) |
|
2089
|
|
|
* @method |
|
2090
|
|
|
* @memberof Popper.Utils |
|
2091
|
|
|
* @argument {Element} element |
|
2092
|
|
|
* @returns {Object} object containing width and height properties |
|
2093
|
|
|
*/ |
|
2094
|
|
|
function getOuterSizes(element) { |
|
2095
|
|
|
var styles = getComputedStyle(element); |
|
2096
|
|
|
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom); |
|
2097
|
|
|
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight); |
|
2098
|
|
|
var result = { |
|
2099
|
|
|
width: element.offsetWidth + y, |
|
2100
|
|
|
height: element.offsetHeight + x |
|
2101
|
|
|
}; |
|
2102
|
|
|
return result; |
|
2103
|
|
|
} |
|
2104
|
|
|
|
|
2105
|
|
|
/** |
|
2106
|
|
|
* Get the opposite placement of the given one |
|
2107
|
|
|
* @method |
|
2108
|
|
|
* @memberof Popper.Utils |
|
2109
|
|
|
* @argument {String} placement |
|
2110
|
|
|
* @returns {String} flipped placement |
|
2111
|
|
|
*/ |
|
2112
|
|
|
function getOppositePlacement(placement) { |
|
2113
|
|
|
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; |
|
2114
|
|
|
return placement.replace(/left|right|bottom|top/g, function (matched) { |
|
2115
|
|
|
return hash[matched]; |
|
2116
|
|
|
}); |
|
2117
|
|
|
} |
|
2118
|
|
|
|
|
2119
|
|
|
/** |
|
2120
|
|
|
* Get offsets to the popper |
|
2121
|
|
|
* @method |
|
2122
|
|
|
* @memberof Popper.Utils |
|
2123
|
|
|
* @param {Object} position - CSS position the Popper will get applied |
|
2124
|
|
|
* @param {HTMLElement} popper - the popper element |
|
2125
|
|
|
* @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) |
|
2126
|
|
|
* @param {String} placement - one of the valid placement options |
|
2127
|
|
|
* @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper |
|
2128
|
|
|
*/ |
|
2129
|
|
|
function getPopperOffsets(popper, referenceOffsets, placement) { |
|
2130
|
|
|
placement = placement.split('-')[0]; |
|
2131
|
|
|
|
|
2132
|
|
|
// Get popper node sizes |
|
2133
|
|
|
var popperRect = getOuterSizes(popper); |
|
2134
|
|
|
|
|
2135
|
|
|
// Add position, width and height to our offsets object |
|
2136
|
|
|
var popperOffsets = { |
|
2137
|
|
|
width: popperRect.width, |
|
2138
|
|
|
height: popperRect.height |
|
2139
|
|
|
}; |
|
2140
|
|
|
|
|
2141
|
|
|
// depending by the popper placement we have to compute its offsets slightly differently |
|
2142
|
|
|
var isHoriz = ['right', 'left'].indexOf(placement) !== -1; |
|
2143
|
|
|
var mainSide = isHoriz ? 'top' : 'left'; |
|
2144
|
|
|
var secondarySide = isHoriz ? 'left' : 'top'; |
|
2145
|
|
|
var measurement = isHoriz ? 'height' : 'width'; |
|
2146
|
|
|
var secondaryMeasurement = !isHoriz ? 'height' : 'width'; |
|
2147
|
|
|
|
|
2148
|
|
|
popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; |
|
2149
|
|
|
if (placement === secondarySide) { |
|
2150
|
|
|
popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; |
|
2151
|
|
|
} else { |
|
2152
|
|
|
popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; |
|
2153
|
|
|
} |
|
2154
|
|
|
|
|
2155
|
|
|
return popperOffsets; |
|
2156
|
|
|
} |
|
2157
|
|
|
|
|
2158
|
|
|
/** |
|
2159
|
|
|
* Mimics the `find` method of Array |
|
2160
|
|
|
* @method |
|
2161
|
|
|
* @memberof Popper.Utils |
|
2162
|
|
|
* @argument {Array} arr |
|
2163
|
|
|
* @argument prop |
|
2164
|
|
|
* @argument value |
|
2165
|
|
|
* @returns index or -1 |
|
2166
|
|
|
*/ |
|
2167
|
|
|
function find(arr, check) { |
|
2168
|
|
|
// use native find if supported |
|
2169
|
|
|
if (Array.prototype.find) { |
|
2170
|
|
|
return arr.find(check); |
|
2171
|
|
|
} |
|
2172
|
|
|
|
|
2173
|
|
|
// use `filter` to obtain the same behavior of `find` |
|
2174
|
|
|
return arr.filter(check)[0]; |
|
2175
|
|
|
} |
|
2176
|
|
|
|
|
2177
|
|
|
/** |
|
2178
|
|
|
* Return the index of the matching object |
|
2179
|
|
|
* @method |
|
2180
|
|
|
* @memberof Popper.Utils |
|
2181
|
|
|
* @argument {Array} arr |
|
2182
|
|
|
* @argument prop |
|
2183
|
|
|
* @argument value |
|
2184
|
|
|
* @returns index or -1 |
|
2185
|
|
|
*/ |
|
2186
|
|
|
function findIndex(arr, prop, value) { |
|
2187
|
|
|
// use native findIndex if supported |
|
2188
|
|
|
if (Array.prototype.findIndex) { |
|
2189
|
|
|
return arr.findIndex(function (cur) { |
|
2190
|
|
|
return cur[prop] === value; |
|
2191
|
|
|
}); |
|
2192
|
|
|
} |
|
2193
|
|
|
|
|
2194
|
|
|
// use `find` + `indexOf` if `findIndex` isn't supported |
|
2195
|
|
|
var match = find(arr, function (obj) { |
|
2196
|
|
|
return obj[prop] === value; |
|
2197
|
|
|
}); |
|
2198
|
|
|
return arr.indexOf(match); |
|
2199
|
|
|
} |
|
2200
|
|
|
|
|
2201
|
|
|
/** |
|
2202
|
|
|
* Loop trough the list of modifiers and run them in order, |
|
2203
|
|
|
* each of them will then edit the data object. |
|
2204
|
|
|
* @method |
|
2205
|
|
|
* @memberof Popper.Utils |
|
2206
|
|
|
* @param {dataObject} data |
|
2207
|
|
|
* @param {Array} modifiers |
|
2208
|
|
|
* @param {String} ends - Optional modifier name used as stopper |
|
2209
|
|
|
* @returns {dataObject} |
|
2210
|
|
|
*/ |
|
2211
|
|
|
function runModifiers(modifiers, data, ends) { |
|
2212
|
|
|
var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); |
|
2213
|
|
|
|
|
2214
|
|
|
modifiersToRun.forEach(function (modifier) { |
|
2215
|
|
|
if (modifier['function']) { |
|
2216
|
|
|
// eslint-disable-line dot-notation |
|
2217
|
|
|
console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); |
|
2218
|
|
|
} |
|
2219
|
|
|
var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation |
|
2220
|
|
|
if (modifier.enabled && isFunction(fn)) { |
|
2221
|
|
|
// Add properties to offsets to make them a complete clientRect object |
|
2222
|
|
|
// we do this before each modifier to make sure the previous one doesn't |
|
2223
|
|
|
// mess with these values |
|
2224
|
|
|
data.offsets.popper = getClientRect(data.offsets.popper); |
|
2225
|
|
|
data.offsets.reference = getClientRect(data.offsets.reference); |
|
2226
|
|
|
|
|
2227
|
|
|
data = fn(data, modifier); |
|
2228
|
|
|
} |
|
2229
|
|
|
}); |
|
2230
|
|
|
|
|
2231
|
|
|
return data; |
|
2232
|
|
|
} |
|
2233
|
|
|
|
|
2234
|
|
|
/** |
|
2235
|
|
|
* Updates the position of the popper, computing the new offsets and applying |
|
2236
|
|
|
* the new style.<br /> |
|
2237
|
|
|
* Prefer `scheduleUpdate` over `update` because of performance reasons. |
|
2238
|
|
|
* @method |
|
2239
|
|
|
* @memberof Popper |
|
2240
|
|
|
*/ |
|
2241
|
|
|
function update() { |
|
2242
|
|
|
// if popper is destroyed, don't perform any further update |
|
2243
|
|
|
if (this.state.isDestroyed) { |
|
2244
|
|
|
return; |
|
2245
|
|
|
} |
|
2246
|
|
|
|
|
2247
|
|
|
var data = { |
|
2248
|
|
|
instance: this, |
|
2249
|
|
|
styles: {}, |
|
2250
|
|
|
arrowStyles: {}, |
|
2251
|
|
|
attributes: {}, |
|
2252
|
|
|
flipped: false, |
|
2253
|
|
|
offsets: {} |
|
2254
|
|
|
}; |
|
2255
|
|
|
|
|
2256
|
|
|
// compute reference element offsets |
|
2257
|
|
|
data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference); |
|
2258
|
|
|
|
|
2259
|
|
|
// compute auto placement, store placement inside the data object, |
|
2260
|
|
|
// modifiers will be able to edit `placement` if needed |
|
2261
|
|
|
// and refer to originalPlacement to know the original value |
|
2262
|
|
|
data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); |
|
2263
|
|
|
|
|
2264
|
|
|
// store the computed placement inside `originalPlacement` |
|
2265
|
|
|
data.originalPlacement = data.placement; |
|
2266
|
|
|
|
|
2267
|
|
|
// compute the popper offsets |
|
2268
|
|
|
data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); |
|
2269
|
|
|
data.offsets.popper.position = 'absolute'; |
|
2270
|
|
|
|
|
2271
|
|
|
// run the modifiers |
|
2272
|
|
|
data = runModifiers(this.modifiers, data); |
|
2273
|
|
|
|
|
2274
|
|
|
// the first `update` will call `onCreate` callback |
|
2275
|
|
|
// the other ones will call `onUpdate` callback |
|
2276
|
|
|
if (!this.state.isCreated) { |
|
2277
|
|
|
this.state.isCreated = true; |
|
2278
|
|
|
this.options.onCreate(data); |
|
2279
|
|
|
} else { |
|
2280
|
|
|
this.options.onUpdate(data); |
|
2281
|
|
|
} |
|
2282
|
|
|
} |
|
2283
|
|
|
|
|
2284
|
|
|
/** |
|
2285
|
|
|
* Helper used to know if the given modifier is enabled. |
|
2286
|
|
|
* @method |
|
2287
|
|
|
* @memberof Popper.Utils |
|
2288
|
|
|
* @returns {Boolean} |
|
2289
|
|
|
*/ |
|
2290
|
|
|
function isModifierEnabled(modifiers, modifierName) { |
|
2291
|
|
|
return modifiers.some(function (_ref) { |
|
2292
|
|
|
var name = _ref.name, |
|
2293
|
|
|
enabled = _ref.enabled; |
|
2294
|
|
|
return enabled && name === modifierName; |
|
2295
|
|
|
}); |
|
2296
|
|
|
} |
|
2297
|
|
|
|
|
2298
|
|
|
/** |
|
2299
|
|
|
* Get the prefixed supported property name |
|
2300
|
|
|
* @method |
|
2301
|
|
|
* @memberof Popper.Utils |
|
2302
|
|
|
* @argument {String} property (camelCase) |
|
2303
|
|
|
* @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) |
|
2304
|
|
|
*/ |
|
2305
|
|
|
function getSupportedPropertyName(property) { |
|
2306
|
|
|
var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; |
|
2307
|
|
|
var upperProp = property.charAt(0).toUpperCase() + property.slice(1); |
|
2308
|
|
|
|
|
2309
|
|
|
for (var i = 0; i < prefixes.length - 1; i++) { |
|
2310
|
|
|
var prefix = prefixes[i]; |
|
2311
|
|
|
var toCheck = prefix ? '' + prefix + upperProp : property; |
|
2312
|
|
|
if (typeof document.body.style[toCheck] !== 'undefined') { |
|
2313
|
|
|
return toCheck; |
|
2314
|
|
|
} |
|
2315
|
|
|
} |
|
2316
|
|
|
return null; |
|
2317
|
|
|
} |
|
2318
|
|
|
|
|
2319
|
|
|
/** |
|
2320
|
|
|
* Destroy the popper |
|
2321
|
|
|
* @method |
|
2322
|
|
|
* @memberof Popper |
|
2323
|
|
|
*/ |
|
2324
|
|
|
function destroy() { |
|
2325
|
|
|
this.state.isDestroyed = true; |
|
2326
|
|
|
|
|
2327
|
|
|
// touch DOM only if `applyStyle` modifier is enabled |
|
2328
|
|
|
if (isModifierEnabled(this.modifiers, 'applyStyle')) { |
|
2329
|
|
|
this.popper.removeAttribute('x-placement'); |
|
2330
|
|
|
this.popper.style.left = ''; |
|
2331
|
|
|
this.popper.style.position = ''; |
|
2332
|
|
|
this.popper.style.top = ''; |
|
2333
|
|
|
this.popper.style[getSupportedPropertyName('transform')] = ''; |
|
2334
|
|
|
} |
|
2335
|
|
|
|
|
2336
|
|
|
this.disableEventListeners(); |
|
2337
|
|
|
|
|
2338
|
|
|
// remove the popper if user explicity asked for the deletion on destroy |
|
2339
|
|
|
// do not use `remove` because IE11 doesn't support it |
|
2340
|
|
|
if (this.options.removeOnDestroy) { |
|
2341
|
|
|
this.popper.parentNode.removeChild(this.popper); |
|
2342
|
|
|
} |
|
2343
|
|
|
return this; |
|
2344
|
|
|
} |
|
2345
|
|
|
|
|
2346
|
|
|
/** |
|
2347
|
|
|
* Get the window associated with the element |
|
2348
|
|
|
* @argument {Element} element |
|
2349
|
|
|
* @returns {Window} |
|
2350
|
|
|
*/ |
|
2351
|
|
|
function getWindow(element) { |
|
2352
|
|
|
var ownerDocument = element.ownerDocument; |
|
2353
|
|
|
return ownerDocument ? ownerDocument.defaultView : window; |
|
2354
|
|
|
} |
|
2355
|
|
|
|
|
2356
|
|
|
function attachToScrollParents(scrollParent, event, callback, scrollParents) { |
|
2357
|
|
|
var isBody = scrollParent.nodeName === 'BODY'; |
|
2358
|
|
|
var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; |
|
2359
|
|
|
target.addEventListener(event, callback, { passive: true }); |
|
2360
|
|
|
|
|
2361
|
|
|
if (!isBody) { |
|
2362
|
|
|
attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); |
|
2363
|
|
|
} |
|
2364
|
|
|
scrollParents.push(target); |
|
2365
|
|
|
} |
|
2366
|
|
|
|
|
2367
|
|
|
/** |
|
2368
|
|
|
* Setup needed event listeners used to update the popper position |
|
2369
|
|
|
* @method |
|
2370
|
|
|
* @memberof Popper.Utils |
|
2371
|
|
|
* @private |
|
2372
|
|
|
*/ |
|
2373
|
|
|
function setupEventListeners(reference, options, state, updateBound) { |
|
2374
|
|
|
// Resize event listener on window |
|
2375
|
|
|
state.updateBound = updateBound; |
|
2376
|
|
|
getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); |
|
2377
|
|
|
|
|
2378
|
|
|
// Scroll event listener on scroll parents |
|
2379
|
|
|
var scrollElement = getScrollParent(reference); |
|
2380
|
|
|
attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); |
|
2381
|
|
|
state.scrollElement = scrollElement; |
|
2382
|
|
|
state.eventsEnabled = true; |
|
2383
|
|
|
|
|
2384
|
|
|
return state; |
|
2385
|
|
|
} |
|
2386
|
|
|
|
|
2387
|
|
|
/** |
|
2388
|
|
|
* It will add resize/scroll events and start recalculating |
|
2389
|
|
|
* position of the popper element when they are triggered. |
|
2390
|
|
|
* @method |
|
2391
|
|
|
* @memberof Popper |
|
2392
|
|
|
*/ |
|
2393
|
|
|
function enableEventListeners() { |
|
2394
|
|
|
if (!this.state.eventsEnabled) { |
|
2395
|
|
|
this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); |
|
2396
|
|
|
} |
|
2397
|
|
|
} |
|
2398
|
|
|
|
|
2399
|
|
|
/** |
|
2400
|
|
|
* Remove event listeners used to update the popper position |
|
2401
|
|
|
* @method |
|
2402
|
|
|
* @memberof Popper.Utils |
|
2403
|
|
|
* @private |
|
2404
|
|
|
*/ |
|
2405
|
|
|
function removeEventListeners(reference, state) { |
|
2406
|
|
|
// Remove resize event listener on window |
|
2407
|
|
|
getWindow(reference).removeEventListener('resize', state.updateBound); |
|
2408
|
|
|
|
|
2409
|
|
|
// Remove scroll event listener on scroll parents |
|
2410
|
|
|
state.scrollParents.forEach(function (target) { |
|
2411
|
|
|
target.removeEventListener('scroll', state.updateBound); |
|
2412
|
|
|
}); |
|
2413
|
|
|
|
|
2414
|
|
|
// Reset state |
|
2415
|
|
|
state.updateBound = null; |
|
2416
|
|
|
state.scrollParents = []; |
|
2417
|
|
|
state.scrollElement = null; |
|
2418
|
|
|
state.eventsEnabled = false; |
|
2419
|
|
|
return state; |
|
2420
|
|
|
} |
|
2421
|
|
|
|
|
2422
|
|
|
/** |
|
2423
|
|
|
* It will remove resize/scroll events and won't recalculate popper position |
|
2424
|
|
|
* when they are triggered. It also won't trigger onUpdate callback anymore, |
|
2425
|
|
|
* unless you call `update` method manually. |
|
2426
|
|
|
* @method |
|
2427
|
|
|
* @memberof Popper |
|
2428
|
|
|
*/ |
|
2429
|
|
|
function disableEventListeners() { |
|
2430
|
|
|
if (this.state.eventsEnabled) { |
|
2431
|
|
|
cancelAnimationFrame(this.scheduleUpdate); |
|
2432
|
|
|
this.state = removeEventListeners(this.reference, this.state); |
|
2433
|
|
|
} |
|
2434
|
|
|
} |
|
2435
|
|
|
|
|
2436
|
|
|
/** |
|
2437
|
|
|
* Tells if a given input is a number |
|
2438
|
|
|
* @method |
|
2439
|
|
|
* @memberof Popper.Utils |
|
2440
|
|
|
* @param {*} input to check |
|
2441
|
|
|
* @return {Boolean} |
|
2442
|
|
|
*/ |
|
2443
|
|
|
function isNumeric(n) { |
|
2444
|
|
|
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); |
|
2445
|
|
|
} |
|
2446
|
|
|
|
|
2447
|
|
|
/** |
|
2448
|
|
|
* Set the style to the given popper |
|
2449
|
|
|
* @method |
|
2450
|
|
|
* @memberof Popper.Utils |
|
2451
|
|
|
* @argument {Element} element - Element to apply the style to |
|
2452
|
|
|
* @argument {Object} styles |
|
2453
|
|
|
* Object with a list of properties and values which will be applied to the element |
|
2454
|
|
|
*/ |
|
2455
|
|
|
function setStyles(element, styles) { |
|
2456
|
|
|
Object.keys(styles).forEach(function (prop) { |
|
2457
|
|
|
var unit = ''; |
|
2458
|
|
|
// add unit if the value is numeric and is one of the following |
|
2459
|
|
|
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { |
|
2460
|
|
|
unit = 'px'; |
|
2461
|
|
|
} |
|
2462
|
|
|
element.style[prop] = styles[prop] + unit; |
|
2463
|
|
|
}); |
|
2464
|
|
|
} |
|
2465
|
|
|
|
|
2466
|
|
|
/** |
|
2467
|
|
|
* Set the attributes to the given popper |
|
2468
|
|
|
* @method |
|
2469
|
|
|
* @memberof Popper.Utils |
|
2470
|
|
|
* @argument {Element} element - Element to apply the attributes to |
|
2471
|
|
|
* @argument {Object} styles |
|
2472
|
|
|
* Object with a list of properties and values which will be applied to the element |
|
2473
|
|
|
*/ |
|
2474
|
|
|
function setAttributes(element, attributes) { |
|
2475
|
|
|
Object.keys(attributes).forEach(function (prop) { |
|
2476
|
|
|
var value = attributes[prop]; |
|
2477
|
|
|
if (value !== false) { |
|
2478
|
|
|
element.setAttribute(prop, attributes[prop]); |
|
2479
|
|
|
} else { |
|
2480
|
|
|
element.removeAttribute(prop); |
|
2481
|
|
|
} |
|
2482
|
|
|
}); |
|
2483
|
|
|
} |
|
2484
|
|
|
|
|
2485
|
|
|
/** |
|
2486
|
|
|
* @function |
|
2487
|
|
|
* @memberof Modifiers |
|
2488
|
|
|
* @argument {Object} data - The data object generated by `update` method |
|
2489
|
|
|
* @argument {Object} data.styles - List of style properties - values to apply to popper element |
|
2490
|
|
|
* @argument {Object} data.attributes - List of attribute properties - values to apply to popper element |
|
2491
|
|
|
* @argument {Object} options - Modifiers configuration and options |
|
2492
|
|
|
* @returns {Object} The same data object |
|
2493
|
|
|
*/ |
|
2494
|
|
|
function applyStyle(data) { |
|
2495
|
|
|
// any property present in `data.styles` will be applied to the popper, |
|
2496
|
|
|
// in this way we can make the 3rd party modifiers add custom styles to it |
|
2497
|
|
|
// Be aware, modifiers could override the properties defined in the previous |
|
2498
|
|
|
// lines of this modifier! |
|
2499
|
|
|
setStyles(data.instance.popper, data.styles); |
|
2500
|
|
|
|
|
2501
|
|
|
// any property present in `data.attributes` will be applied to the popper, |
|
2502
|
|
|
// they will be set as HTML attributes of the element |
|
2503
|
|
|
setAttributes(data.instance.popper, data.attributes); |
|
2504
|
|
|
|
|
2505
|
|
|
// if arrowElement is defined and arrowStyles has some properties |
|
2506
|
|
|
if (data.arrowElement && Object.keys(data.arrowStyles).length) { |
|
2507
|
|
|
setStyles(data.arrowElement, data.arrowStyles); |
|
2508
|
|
|
} |
|
2509
|
|
|
|
|
2510
|
|
|
return data; |
|
2511
|
|
|
} |
|
2512
|
|
|
|
|
2513
|
|
|
/** |
|
2514
|
|
|
* Set the x-placement attribute before everything else because it could be used |
|
2515
|
|
|
* to add margins to the popper margins needs to be calculated to get the |
|
2516
|
|
|
* correct popper offsets. |
|
2517
|
|
|
* @method |
|
2518
|
|
|
* @memberof Popper.modifiers |
|
2519
|
|
|
* @param {HTMLElement} reference - The reference element used to position the popper |
|
2520
|
|
|
* @param {HTMLElement} popper - The HTML element used as popper. |
|
2521
|
|
|
* @param {Object} options - Popper.js options |
|
2522
|
|
|
*/ |
|
2523
|
|
|
function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { |
|
2524
|
|
|
// compute reference element offsets |
|
2525
|
|
|
var referenceOffsets = getReferenceOffsets(state, popper, reference); |
|
2526
|
|
|
|
|
2527
|
|
|
// compute auto placement, store placement inside the data object, |
|
2528
|
|
|
// modifiers will be able to edit `placement` if needed |
|
2529
|
|
|
// and refer to originalPlacement to know the original value |
|
2530
|
|
|
var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); |
|
2531
|
|
|
|
|
2532
|
|
|
popper.setAttribute('x-placement', placement); |
|
2533
|
|
|
|
|
2534
|
|
|
// Apply `position` to popper before anything else because |
|
2535
|
|
|
// without the position applied we can't guarantee correct computations |
|
2536
|
|
|
setStyles(popper, { position: 'absolute' }); |
|
2537
|
|
|
|
|
2538
|
|
|
return options; |
|
2539
|
|
|
} |
|
2540
|
|
|
|
|
2541
|
|
|
/** |
|
2542
|
|
|
* @function |
|
2543
|
|
|
* @memberof Modifiers |
|
2544
|
|
|
* @argument {Object} data - The data object generated by `update` method |
|
2545
|
|
|
* @argument {Object} options - Modifiers configuration and options |
|
2546
|
|
|
* @returns {Object} The data object, properly modified |
|
2547
|
|
|
*/ |
|
2548
|
|
|
function computeStyle(data, options) { |
|
2549
|
|
|
var x = options.x, |
|
2550
|
|
|
y = options.y; |
|
2551
|
|
|
var popper = data.offsets.popper; |
|
2552
|
|
|
|
|
2553
|
|
|
// Remove this legacy support in Popper.js v2 |
|
2554
|
|
|
|
|
2555
|
|
|
var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { |
|
2556
|
|
|
return modifier.name === 'applyStyle'; |
|
2557
|
|
|
}).gpuAcceleration; |
|
2558
|
|
|
if (legacyGpuAccelerationOption !== undefined) { |
|
2559
|
|
|
console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); |
|
2560
|
|
|
} |
|
2561
|
|
|
var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; |
|
2562
|
|
|
|
|
2563
|
|
|
var offsetParent = getOffsetParent(data.instance.popper); |
|
2564
|
|
|
var offsetParentRect = getBoundingClientRect(offsetParent); |
|
2565
|
|
|
|
|
2566
|
|
|
// Styles |
|
2567
|
|
|
var styles = { |
|
2568
|
|
|
position: popper.position |
|
2569
|
|
|
}; |
|
2570
|
|
|
|
|
2571
|
|
|
// floor sides to avoid blurry text |
|
2572
|
|
|
var offsets = { |
|
2573
|
|
|
left: Math.floor(popper.left), |
|
2574
|
|
|
top: Math.floor(popper.top), |
|
2575
|
|
|
bottom: Math.floor(popper.bottom), |
|
2576
|
|
|
right: Math.floor(popper.right) |
|
2577
|
|
|
}; |
|
2578
|
|
|
|
|
2579
|
|
|
var sideA = x === 'bottom' ? 'top' : 'bottom'; |
|
2580
|
|
|
var sideB = y === 'right' ? 'left' : 'right'; |
|
2581
|
|
|
|
|
2582
|
|
|
// if gpuAcceleration is set to `true` and transform is supported, |
|
2583
|
|
|
// we use `translate3d` to apply the position to the popper we |
|
2584
|
|
|
// automatically use the supported prefixed version if needed |
|
2585
|
|
|
var prefixedProperty = getSupportedPropertyName('transform'); |
|
2586
|
|
|
|
|
2587
|
|
|
// now, let's make a step back and look at this code closely (wtf?) |
|
2588
|
|
|
// If the content of the popper grows once it's been positioned, it |
|
2589
|
|
|
// may happen that the popper gets misplaced because of the new content |
|
2590
|
|
|
// overflowing its reference element |
|
2591
|
|
|
// To avoid this problem, we provide two options (x and y), which allow |
|
2592
|
|
|
// the consumer to define the offset origin. |
|
2593
|
|
|
// If we position a popper on top of a reference element, we can set |
|
2594
|
|
|
// `x` to `top` to make the popper grow towards its top instead of |
|
2595
|
|
|
// its bottom. |
|
2596
|
|
|
var left = void 0, |
|
|
|
|
|
|
2597
|
|
|
top = void 0; |
|
|
|
|
|
|
2598
|
|
|
if (sideA === 'bottom') { |
|
2599
|
|
|
top = -offsetParentRect.height + offsets.bottom; |
|
2600
|
|
|
} else { |
|
2601
|
|
|
top = offsets.top; |
|
2602
|
|
|
} |
|
2603
|
|
|
if (sideB === 'right') { |
|
2604
|
|
|
left = -offsetParentRect.width + offsets.right; |
|
2605
|
|
|
} else { |
|
2606
|
|
|
left = offsets.left; |
|
2607
|
|
|
} |
|
2608
|
|
|
if (gpuAcceleration && prefixedProperty) { |
|
2609
|
|
|
styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; |
|
2610
|
|
|
styles[sideA] = 0; |
|
2611
|
|
|
styles[sideB] = 0; |
|
2612
|
|
|
styles.willChange = 'transform'; |
|
2613
|
|
|
} else { |
|
2614
|
|
|
// othwerise, we use the standard `top`, `left`, `bottom` and `right` properties |
|
2615
|
|
|
var invertTop = sideA === 'bottom' ? -1 : 1; |
|
2616
|
|
|
var invertLeft = sideB === 'right' ? -1 : 1; |
|
2617
|
|
|
styles[sideA] = top * invertTop; |
|
2618
|
|
|
styles[sideB] = left * invertLeft; |
|
2619
|
|
|
styles.willChange = sideA + ', ' + sideB; |
|
2620
|
|
|
} |
|
2621
|
|
|
|
|
2622
|
|
|
// Attributes |
|
2623
|
|
|
var attributes = { |
|
2624
|
|
|
'x-placement': data.placement |
|
2625
|
|
|
}; |
|
2626
|
|
|
|
|
2627
|
|
|
// Update `data` attributes, styles and arrowStyles |
|
2628
|
|
|
data.attributes = _extends$1({}, attributes, data.attributes); |
|
2629
|
|
|
data.styles = _extends$1({}, styles, data.styles); |
|
2630
|
|
|
data.arrowStyles = _extends$1({}, data.offsets.arrow, data.arrowStyles); |
|
2631
|
|
|
|
|
2632
|
|
|
return data; |
|
2633
|
|
|
} |
|
2634
|
|
|
|
|
2635
|
|
|
/** |
|
2636
|
|
|
* Helper used to know if the given modifier depends from another one.<br /> |
|
2637
|
|
|
* It checks if the needed modifier is listed and enabled. |
|
2638
|
|
|
* @method |
|
2639
|
|
|
* @memberof Popper.Utils |
|
2640
|
|
|
* @param {Array} modifiers - list of modifiers |
|
2641
|
|
|
* @param {String} requestingName - name of requesting modifier |
|
2642
|
|
|
* @param {String} requestedName - name of requested modifier |
|
2643
|
|
|
* @returns {Boolean} |
|
2644
|
|
|
*/ |
|
2645
|
|
|
function isModifierRequired(modifiers, requestingName, requestedName) { |
|
2646
|
|
|
var requesting = find(modifiers, function (_ref) { |
|
2647
|
|
|
var name = _ref.name; |
|
2648
|
|
|
return name === requestingName; |
|
2649
|
|
|
}); |
|
2650
|
|
|
|
|
2651
|
|
|
var isRequired = !!requesting && modifiers.some(function (modifier) { |
|
2652
|
|
|
return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; |
|
2653
|
|
|
}); |
|
2654
|
|
|
|
|
2655
|
|
|
if (!isRequired) { |
|
2656
|
|
|
var _requesting = '`' + requestingName + '`'; |
|
2657
|
|
|
var requested = '`' + requestedName + '`'; |
|
2658
|
|
|
console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); |
|
2659
|
|
|
} |
|
2660
|
|
|
return isRequired; |
|
2661
|
|
|
} |
|
2662
|
|
|
|
|
2663
|
|
|
/** |
|
2664
|
|
|
* @function |
|
2665
|
|
|
* @memberof Modifiers |
|
2666
|
|
|
* @argument {Object} data - The data object generated by update method |
|
2667
|
|
|
* @argument {Object} options - Modifiers configuration and options |
|
2668
|
|
|
* @returns {Object} The data object, properly modified |
|
2669
|
|
|
*/ |
|
2670
|
|
|
function arrow(data, options) { |
|
2671
|
|
|
var _data$offsets$arrow; |
|
2672
|
|
|
|
|
2673
|
|
|
// arrow depends on keepTogether in order to work |
|
2674
|
|
|
if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { |
|
2675
|
|
|
return data; |
|
2676
|
|
|
} |
|
2677
|
|
|
|
|
2678
|
|
|
var arrowElement = options.element; |
|
2679
|
|
|
|
|
2680
|
|
|
// if arrowElement is a string, suppose it's a CSS selector |
|
2681
|
|
|
if (typeof arrowElement === 'string') { |
|
2682
|
|
|
arrowElement = data.instance.popper.querySelector(arrowElement); |
|
2683
|
|
|
|
|
2684
|
|
|
// if arrowElement is not found, don't run the modifier |
|
2685
|
|
|
if (!arrowElement) { |
|
2686
|
|
|
return data; |
|
2687
|
|
|
} |
|
2688
|
|
|
} else { |
|
2689
|
|
|
// if the arrowElement isn't a query selector we must check that the |
|
2690
|
|
|
// provided DOM node is child of its popper node |
|
2691
|
|
|
if (!data.instance.popper.contains(arrowElement)) { |
|
2692
|
|
|
console.warn('WARNING: `arrow.element` must be child of its popper element!'); |
|
2693
|
|
|
return data; |
|
2694
|
|
|
} |
|
2695
|
|
|
} |
|
2696
|
|
|
|
|
2697
|
|
|
var placement = data.placement.split('-')[0]; |
|
2698
|
|
|
var _data$offsets = data.offsets, |
|
2699
|
|
|
popper = _data$offsets.popper, |
|
2700
|
|
|
reference = _data$offsets.reference; |
|
2701
|
|
|
|
|
2702
|
|
|
var isVertical = ['left', 'right'].indexOf(placement) !== -1; |
|
2703
|
|
|
|
|
2704
|
|
|
var len = isVertical ? 'height' : 'width'; |
|
2705
|
|
|
var sideCapitalized = isVertical ? 'Top' : 'Left'; |
|
2706
|
|
|
var side = sideCapitalized.toLowerCase(); |
|
2707
|
|
|
var altSide = isVertical ? 'left' : 'top'; |
|
2708
|
|
|
var opSide = isVertical ? 'bottom' : 'right'; |
|
2709
|
|
|
var arrowElementSize = getOuterSizes(arrowElement)[len]; |
|
2710
|
|
|
|
|
2711
|
|
|
// |
|
2712
|
|
|
// extends keepTogether behavior making sure the popper and its |
|
2713
|
|
|
// reference have enough pixels in conjuction |
|
2714
|
|
|
// |
|
2715
|
|
|
|
|
2716
|
|
|
// top/left side |
|
2717
|
|
|
if (reference[opSide] - arrowElementSize < popper[side]) { |
|
2718
|
|
|
data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); |
|
2719
|
|
|
} |
|
2720
|
|
|
// bottom/right side |
|
2721
|
|
|
if (reference[side] + arrowElementSize > popper[opSide]) { |
|
2722
|
|
|
data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; |
|
2723
|
|
|
} |
|
2724
|
|
|
data.offsets.popper = getClientRect(data.offsets.popper); |
|
2725
|
|
|
|
|
2726
|
|
|
// compute center of the popper |
|
2727
|
|
|
var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; |
|
2728
|
|
|
|
|
2729
|
|
|
// Compute the sideValue using the updated popper offsets |
|
2730
|
|
|
// take popper margin in account because we don't have this info available |
|
2731
|
|
|
var css = getStyleComputedProperty(data.instance.popper); |
|
2732
|
|
|
var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10); |
|
2733
|
|
|
var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10); |
|
2734
|
|
|
var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; |
|
2735
|
|
|
|
|
2736
|
|
|
// prevent arrowElement from being placed not contiguously to its popper |
|
2737
|
|
|
sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); |
|
2738
|
|
|
|
|
2739
|
|
|
data.arrowElement = arrowElement; |
|
2740
|
|
|
data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); |
|
|
|
|
|
|
2741
|
|
|
|
|
2742
|
|
|
return data; |
|
2743
|
|
|
} |
|
2744
|
|
|
|
|
2745
|
|
|
/** |
|
2746
|
|
|
* Get the opposite placement variation of the given one |
|
2747
|
|
|
* @method |
|
2748
|
|
|
* @memberof Popper.Utils |
|
2749
|
|
|
* @argument {String} placement variation |
|
2750
|
|
|
* @returns {String} flipped placement variation |
|
2751
|
|
|
*/ |
|
2752
|
|
|
function getOppositeVariation(variation) { |
|
2753
|
|
|
if (variation === 'end') { |
|
2754
|
|
|
return 'start'; |
|
2755
|
|
|
} else if (variation === 'start') { |
|
2756
|
|
|
return 'end'; |
|
2757
|
|
|
} |
|
2758
|
|
|
return variation; |
|
2759
|
|
|
} |
|
2760
|
|
|
|
|
2761
|
|
|
/** |
|
2762
|
|
|
* List of accepted placements to use as values of the `placement` option.<br /> |
|
2763
|
|
|
* Valid placements are: |
|
2764
|
|
|
* - `auto` |
|
2765
|
|
|
* - `top` |
|
2766
|
|
|
* - `right` |
|
2767
|
|
|
* - `bottom` |
|
2768
|
|
|
* - `left` |
|
2769
|
|
|
* |
|
2770
|
|
|
* Each placement can have a variation from this list: |
|
2771
|
|
|
* - `-start` |
|
2772
|
|
|
* - `-end` |
|
2773
|
|
|
* |
|
2774
|
|
|
* Variations are interpreted easily if you think of them as the left to right |
|
2775
|
|
|
* written languages. Horizontally (`top` and `bottom`), `start` is left and `end` |
|
2776
|
|
|
* is right.<br /> |
|
2777
|
|
|
* Vertically (`left` and `right`), `start` is top and `end` is bottom. |
|
2778
|
|
|
* |
|
2779
|
|
|
* Some valid examples are: |
|
2780
|
|
|
* - `top-end` (on top of reference, right aligned) |
|
2781
|
|
|
* - `right-start` (on right of reference, top aligned) |
|
2782
|
|
|
* - `bottom` (on bottom, centered) |
|
2783
|
|
|
* - `auto-right` (on the side with more space available, alignment depends by placement) |
|
2784
|
|
|
* |
|
2785
|
|
|
* @static |
|
2786
|
|
|
* @type {Array} |
|
2787
|
|
|
* @enum {String} |
|
2788
|
|
|
* @readonly |
|
2789
|
|
|
* @method placements |
|
2790
|
|
|
* @memberof Popper |
|
2791
|
|
|
*/ |
|
2792
|
|
|
var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; |
|
2793
|
|
|
|
|
2794
|
|
|
// Get rid of `auto` `auto-start` and `auto-end` |
|
2795
|
|
|
var validPlacements = placements.slice(3); |
|
2796
|
|
|
|
|
2797
|
|
|
/** |
|
2798
|
|
|
* Given an initial placement, returns all the subsequent placements |
|
2799
|
|
|
* clockwise (or counter-clockwise). |
|
2800
|
|
|
* |
|
2801
|
|
|
* @method |
|
2802
|
|
|
* @memberof Popper.Utils |
|
2803
|
|
|
* @argument {String} placement - A valid placement (it accepts variations) |
|
2804
|
|
|
* @argument {Boolean} counter - Set to true to walk the placements counterclockwise |
|
2805
|
|
|
* @returns {Array} placements including their variations |
|
2806
|
|
|
*/ |
|
2807
|
|
|
function clockwise(placement) { |
|
2808
|
|
|
var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; |
|
2809
|
|
|
|
|
2810
|
|
|
var index = validPlacements.indexOf(placement); |
|
2811
|
|
|
var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); |
|
2812
|
|
|
return counter ? arr.reverse() : arr; |
|
2813
|
|
|
} |
|
2814
|
|
|
|
|
2815
|
|
|
var BEHAVIORS = { |
|
2816
|
|
|
FLIP: 'flip', |
|
2817
|
|
|
CLOCKWISE: 'clockwise', |
|
2818
|
|
|
COUNTERCLOCKWISE: 'counterclockwise' |
|
2819
|
|
|
}; |
|
2820
|
|
|
|
|
2821
|
|
|
/** |
|
2822
|
|
|
* @function |
|
2823
|
|
|
* @memberof Modifiers |
|
2824
|
|
|
* @argument {Object} data - The data object generated by update method |
|
2825
|
|
|
* @argument {Object} options - Modifiers configuration and options |
|
2826
|
|
|
* @returns {Object} The data object, properly modified |
|
2827
|
|
|
*/ |
|
2828
|
|
|
function flip(data, options) { |
|
2829
|
|
|
// if `inner` modifier is enabled, we can't use the `flip` modifier |
|
2830
|
|
|
if (isModifierEnabled(data.instance.modifiers, 'inner')) { |
|
2831
|
|
|
return data; |
|
2832
|
|
|
} |
|
2833
|
|
|
|
|
2834
|
|
|
if (data.flipped && data.placement === data.originalPlacement) { |
|
2835
|
|
|
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides |
|
2836
|
|
|
return data; |
|
2837
|
|
|
} |
|
2838
|
|
|
|
|
2839
|
|
|
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement); |
|
2840
|
|
|
|
|
2841
|
|
|
var placement = data.placement.split('-')[0]; |
|
2842
|
|
|
var placementOpposite = getOppositePlacement(placement); |
|
2843
|
|
|
var variation = data.placement.split('-')[1] || ''; |
|
2844
|
|
|
|
|
2845
|
|
|
var flipOrder = []; |
|
|
|
|
|
|
2846
|
|
|
|
|
2847
|
|
|
switch (options.behavior) { |
|
2848
|
|
|
case BEHAVIORS.FLIP: |
|
2849
|
|
|
flipOrder = [placement, placementOpposite]; |
|
2850
|
|
|
break; |
|
2851
|
|
|
case BEHAVIORS.CLOCKWISE: |
|
2852
|
|
|
flipOrder = clockwise(placement); |
|
2853
|
|
|
break; |
|
2854
|
|
|
case BEHAVIORS.COUNTERCLOCKWISE: |
|
2855
|
|
|
flipOrder = clockwise(placement, true); |
|
2856
|
|
|
break; |
|
2857
|
|
|
default: |
|
2858
|
|
|
flipOrder = options.behavior; |
|
2859
|
|
|
} |
|
2860
|
|
|
|
|
2861
|
|
|
flipOrder.forEach(function (step, index) { |
|
2862
|
|
|
if (placement !== step || flipOrder.length === index + 1) { |
|
2863
|
|
|
return data; |
|
2864
|
|
|
} |
|
2865
|
|
|
|
|
2866
|
|
|
placement = data.placement.split('-')[0]; |
|
2867
|
|
|
placementOpposite = getOppositePlacement(placement); |
|
2868
|
|
|
|
|
2869
|
|
|
var popperOffsets = data.offsets.popper; |
|
2870
|
|
|
var refOffsets = data.offsets.reference; |
|
2871
|
|
|
|
|
2872
|
|
|
// using floor because the reference offsets may contain decimals we are not going to consider here |
|
2873
|
|
|
var floor = Math.floor; |
|
2874
|
|
|
var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom); |
|
2875
|
|
|
|
|
2876
|
|
|
var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); |
|
2877
|
|
|
var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); |
|
2878
|
|
|
var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); |
|
2879
|
|
|
var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); |
|
2880
|
|
|
|
|
2881
|
|
|
var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; |
|
2882
|
|
|
|
|
2883
|
|
|
// flip the variation if required |
|
2884
|
|
|
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; |
|
2885
|
|
|
var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); |
|
2886
|
|
|
|
|
2887
|
|
|
if (overlapsRef || overflowsBoundaries || flippedVariation) { |
|
|
|
|
|
|
2888
|
|
|
// this boolean to detect any flip loop |
|
2889
|
|
|
data.flipped = true; |
|
2890
|
|
|
|
|
2891
|
|
|
if (overlapsRef || overflowsBoundaries) { |
|
2892
|
|
|
placement = flipOrder[index + 1]; |
|
2893
|
|
|
} |
|
2894
|
|
|
|
|
2895
|
|
|
if (flippedVariation) { |
|
2896
|
|
|
variation = getOppositeVariation(variation); |
|
2897
|
|
|
} |
|
2898
|
|
|
|
|
2899
|
|
|
data.placement = placement + (variation ? '-' + variation : ''); |
|
2900
|
|
|
|
|
2901
|
|
|
// this object contains `position`, we want to preserve it along with |
|
2902
|
|
|
// any additional property we may add in the future |
|
2903
|
|
|
data.offsets.popper = _extends$1({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); |
|
2904
|
|
|
|
|
2905
|
|
|
data = runModifiers(data.instance.modifiers, data, 'flip'); |
|
|
|
|
|
|
2906
|
|
|
} |
|
2907
|
|
|
}); |
|
2908
|
|
|
return data; |
|
2909
|
|
|
} |
|
2910
|
|
|
|
|
2911
|
|
|
/** |
|
2912
|
|
|
* @function |
|
2913
|
|
|
* @memberof Modifiers |
|
2914
|
|
|
* @argument {Object} data - The data object generated by update method |
|
2915
|
|
|
* @argument {Object} options - Modifiers configuration and options |
|
2916
|
|
|
* @returns {Object} The data object, properly modified |
|
2917
|
|
|
*/ |
|
2918
|
|
|
function keepTogether(data) { |
|
2919
|
|
|
var _data$offsets = data.offsets, |
|
2920
|
|
|
popper = _data$offsets.popper, |
|
2921
|
|
|
reference = _data$offsets.reference; |
|
2922
|
|
|
|
|
2923
|
|
|
var placement = data.placement.split('-')[0]; |
|
2924
|
|
|
var floor = Math.floor; |
|
2925
|
|
|
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; |
|
2926
|
|
|
var side = isVertical ? 'right' : 'bottom'; |
|
2927
|
|
|
var opSide = isVertical ? 'left' : 'top'; |
|
2928
|
|
|
var measurement = isVertical ? 'width' : 'height'; |
|
2929
|
|
|
|
|
2930
|
|
|
if (popper[side] < floor(reference[opSide])) { |
|
2931
|
|
|
data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; |
|
2932
|
|
|
} |
|
2933
|
|
|
if (popper[opSide] > floor(reference[side])) { |
|
2934
|
|
|
data.offsets.popper[opSide] = floor(reference[side]); |
|
2935
|
|
|
} |
|
2936
|
|
|
|
|
2937
|
|
|
return data; |
|
2938
|
|
|
} |
|
2939
|
|
|
|
|
2940
|
|
|
/** |
|
2941
|
|
|
* Converts a string containing value + unit into a px value number |
|
2942
|
|
|
* @function |
|
2943
|
|
|
* @memberof {modifiers~offset} |
|
2944
|
|
|
* @private |
|
2945
|
|
|
* @argument {String} str - Value + unit string |
|
2946
|
|
|
* @argument {String} measurement - `height` or `width` |
|
2947
|
|
|
* @argument {Object} popperOffsets |
|
2948
|
|
|
* @argument {Object} referenceOffsets |
|
2949
|
|
|
* @returns {Number|String} |
|
2950
|
|
|
* Value in pixels, or original string if no values were extracted |
|
2951
|
|
|
*/ |
|
2952
|
|
|
function toValue(str, measurement, popperOffsets, referenceOffsets) { |
|
2953
|
|
|
// separate value from unit |
|
2954
|
|
|
var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); |
|
2955
|
|
|
var value = +split[1]; |
|
2956
|
|
|
var unit = split[2]; |
|
2957
|
|
|
|
|
2958
|
|
|
// If it's not a number it's an operator, I guess |
|
2959
|
|
|
if (!value) { |
|
2960
|
|
|
return str; |
|
2961
|
|
|
} |
|
2962
|
|
|
|
|
2963
|
|
|
if (unit.indexOf('%') === 0) { |
|
2964
|
|
|
var element = void 0; |
|
|
|
|
|
|
2965
|
|
|
switch (unit) { |
|
2966
|
|
|
case '%p': |
|
2967
|
|
|
element = popperOffsets; |
|
2968
|
|
|
break; |
|
2969
|
|
|
case '%': |
|
2970
|
|
|
case '%r': |
|
2971
|
|
|
default: |
|
2972
|
|
|
element = referenceOffsets; |
|
2973
|
|
|
} |
|
2974
|
|
|
|
|
2975
|
|
|
var rect = getClientRect(element); |
|
2976
|
|
|
return rect[measurement] / 100 * value; |
|
2977
|
|
|
} else if (unit === 'vh' || unit === 'vw') { |
|
2978
|
|
|
// if is a vh or vw, we calculate the size based on the viewport |
|
2979
|
|
|
var size = void 0; |
|
|
|
|
|
|
2980
|
|
|
if (unit === 'vh') { |
|
2981
|
|
|
size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); |
|
2982
|
|
|
} else { |
|
2983
|
|
|
size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); |
|
2984
|
|
|
} |
|
2985
|
|
|
return size / 100 * value; |
|
2986
|
|
|
} else { |
|
2987
|
|
|
// if is an explicit pixel unit, we get rid of the unit and keep the value |
|
2988
|
|
|
// if is an implicit unit, it's px, and we return just the value |
|
2989
|
|
|
return value; |
|
2990
|
|
|
} |
|
2991
|
|
|
} |
|
2992
|
|
|
|
|
2993
|
|
|
/** |
|
2994
|
|
|
* Parse an `offset` string to extrapolate `x` and `y` numeric offsets. |
|
2995
|
|
|
* @function |
|
2996
|
|
|
* @memberof {modifiers~offset} |
|
2997
|
|
|
* @private |
|
2998
|
|
|
* @argument {String} offset |
|
2999
|
|
|
* @argument {Object} popperOffsets |
|
3000
|
|
|
* @argument {Object} referenceOffsets |
|
3001
|
|
|
* @argument {String} basePlacement |
|
3002
|
|
|
* @returns {Array} a two cells array with x and y offsets in numbers |
|
3003
|
|
|
*/ |
|
3004
|
|
|
function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { |
|
3005
|
|
|
var offsets = [0, 0]; |
|
3006
|
|
|
|
|
3007
|
|
|
// Use height if placement is left or right and index is 0 otherwise use width |
|
3008
|
|
|
// in this way the first offset will use an axis and the second one |
|
3009
|
|
|
// will use the other one |
|
3010
|
|
|
var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; |
|
3011
|
|
|
|
|
3012
|
|
|
// Split the offset string to obtain a list of values and operands |
|
3013
|
|
|
// The regex addresses values with the plus or minus sign in front (+10, -20, etc) |
|
3014
|
|
|
var fragments = offset.split(/(\+|\-)/).map(function (frag) { |
|
3015
|
|
|
return frag.trim(); |
|
3016
|
|
|
}); |
|
3017
|
|
|
|
|
3018
|
|
|
// Detect if the offset string contains a pair of values or a single one |
|
3019
|
|
|
// they could be separated by comma or space |
|
3020
|
|
|
var divider = fragments.indexOf(find(fragments, function (frag) { |
|
3021
|
|
|
return frag.search(/,|\s/) !== -1; |
|
3022
|
|
|
})); |
|
3023
|
|
|
|
|
3024
|
|
|
if (fragments[divider] && fragments[divider].indexOf(',') === -1) { |
|
3025
|
|
|
console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); |
|
3026
|
|
|
} |
|
3027
|
|
|
|
|
3028
|
|
|
// If divider is found, we divide the list of values and operands to divide |
|
3029
|
|
|
// them by ofset X and Y. |
|
3030
|
|
|
var splitRegex = /\s*,\s*|\s+/; |
|
3031
|
|
|
var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; |
|
3032
|
|
|
|
|
3033
|
|
|
// Convert the values with units to absolute pixels to allow our computations |
|
3034
|
|
|
ops = ops.map(function (op, index) { |
|
3035
|
|
|
// Most of the units rely on the orientation of the popper |
|
3036
|
|
|
var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; |
|
3037
|
|
|
var mergeWithPrevious = false; |
|
3038
|
|
|
return op |
|
3039
|
|
|
// This aggregates any `+` or `-` sign that aren't considered operators |
|
3040
|
|
|
// e.g.: 10 + +5 => [10, +, +5] |
|
3041
|
|
|
.reduce(function (a, b) { |
|
3042
|
|
|
if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { |
|
3043
|
|
|
a[a.length - 1] = b; |
|
3044
|
|
|
mergeWithPrevious = true; |
|
3045
|
|
|
return a; |
|
3046
|
|
|
} else if (mergeWithPrevious) { |
|
3047
|
|
|
a[a.length - 1] += b; |
|
3048
|
|
|
mergeWithPrevious = false; |
|
3049
|
|
|
return a; |
|
3050
|
|
|
} else { |
|
3051
|
|
|
return a.concat(b); |
|
3052
|
|
|
} |
|
3053
|
|
|
}, []) |
|
3054
|
|
|
// Here we convert the string values into number values (in px) |
|
3055
|
|
|
.map(function (str) { |
|
3056
|
|
|
return toValue(str, measurement, popperOffsets, referenceOffsets); |
|
3057
|
|
|
}); |
|
3058
|
|
|
}); |
|
3059
|
|
|
|
|
3060
|
|
|
// Loop trough the offsets arrays and execute the operations |
|
3061
|
|
|
ops.forEach(function (op, index) { |
|
3062
|
|
|
op.forEach(function (frag, index2) { |
|
3063
|
|
|
if (isNumeric(frag)) { |
|
3064
|
|
|
offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); |
|
3065
|
|
|
} |
|
3066
|
|
|
}); |
|
3067
|
|
|
}); |
|
3068
|
|
|
return offsets; |
|
3069
|
|
|
} |
|
3070
|
|
|
|
|
3071
|
|
|
/** |
|
3072
|
|
|
* @function |
|
3073
|
|
|
* @memberof Modifiers |
|
3074
|
|
|
* @argument {Object} data - The data object generated by update method |
|
3075
|
|
|
* @argument {Object} options - Modifiers configuration and options |
|
3076
|
|
|
* @argument {Number|String} options.offset=0 |
|
3077
|
|
|
* The offset value as described in the modifier description |
|
3078
|
|
|
* @returns {Object} The data object, properly modified |
|
3079
|
|
|
*/ |
|
3080
|
|
|
function offset(data, _ref) { |
|
3081
|
|
|
var offset = _ref.offset; |
|
3082
|
|
|
var placement = data.placement, |
|
3083
|
|
|
_data$offsets = data.offsets, |
|
3084
|
|
|
popper = _data$offsets.popper, |
|
3085
|
|
|
reference = _data$offsets.reference; |
|
3086
|
|
|
|
|
3087
|
|
|
var basePlacement = placement.split('-')[0]; |
|
3088
|
|
|
|
|
3089
|
|
|
var offsets = void 0; |
|
|
|
|
|
|
3090
|
|
|
if (isNumeric(+offset)) { |
|
3091
|
|
|
offsets = [+offset, 0]; |
|
3092
|
|
|
} else { |
|
3093
|
|
|
offsets = parseOffset(offset, popper, reference, basePlacement); |
|
3094
|
|
|
} |
|
3095
|
|
|
|
|
3096
|
|
|
if (basePlacement === 'left') { |
|
3097
|
|
|
popper.top += offsets[0]; |
|
3098
|
|
|
popper.left -= offsets[1]; |
|
3099
|
|
|
} else if (basePlacement === 'right') { |
|
3100
|
|
|
popper.top += offsets[0]; |
|
3101
|
|
|
popper.left += offsets[1]; |
|
3102
|
|
|
} else if (basePlacement === 'top') { |
|
3103
|
|
|
popper.left += offsets[0]; |
|
3104
|
|
|
popper.top -= offsets[1]; |
|
3105
|
|
|
} else if (basePlacement === 'bottom') { |
|
3106
|
|
|
popper.left += offsets[0]; |
|
3107
|
|
|
popper.top += offsets[1]; |
|
3108
|
|
|
} |
|
3109
|
|
|
|
|
3110
|
|
|
data.popper = popper; |
|
3111
|
|
|
return data; |
|
3112
|
|
|
} |
|
3113
|
|
|
|
|
3114
|
|
|
/** |
|
3115
|
|
|
* @function |
|
3116
|
|
|
* @memberof Modifiers |
|
3117
|
|
|
* @argument {Object} data - The data object generated by `update` method |
|
3118
|
|
|
* @argument {Object} options - Modifiers configuration and options |
|
3119
|
|
|
* @returns {Object} The data object, properly modified |
|
3120
|
|
|
*/ |
|
3121
|
|
|
function preventOverflow(data, options) { |
|
3122
|
|
|
var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); |
|
3123
|
|
|
|
|
3124
|
|
|
// If offsetParent is the reference element, we really want to |
|
3125
|
|
|
// go one step up and use the next offsetParent as reference to |
|
3126
|
|
|
// avoid to make this modifier completely useless and look like broken |
|
3127
|
|
|
if (data.instance.reference === boundariesElement) { |
|
3128
|
|
|
boundariesElement = getOffsetParent(boundariesElement); |
|
3129
|
|
|
} |
|
3130
|
|
|
|
|
3131
|
|
|
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement); |
|
3132
|
|
|
options.boundaries = boundaries; |
|
3133
|
|
|
|
|
3134
|
|
|
var order = options.priority; |
|
3135
|
|
|
var popper = data.offsets.popper; |
|
3136
|
|
|
|
|
3137
|
|
|
var check = { |
|
3138
|
|
|
primary: function primary(placement) { |
|
3139
|
|
|
var value = popper[placement]; |
|
3140
|
|
|
if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { |
|
3141
|
|
|
value = Math.max(popper[placement], boundaries[placement]); |
|
3142
|
|
|
} |
|
3143
|
|
|
return defineProperty({}, placement, value); |
|
3144
|
|
|
}, |
|
3145
|
|
|
secondary: function secondary(placement) { |
|
3146
|
|
|
var mainSide = placement === 'right' ? 'left' : 'top'; |
|
3147
|
|
|
var value = popper[mainSide]; |
|
3148
|
|
|
if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { |
|
3149
|
|
|
value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); |
|
3150
|
|
|
} |
|
3151
|
|
|
return defineProperty({}, mainSide, value); |
|
3152
|
|
|
} |
|
3153
|
|
|
}; |
|
3154
|
|
|
|
|
3155
|
|
|
order.forEach(function (placement) { |
|
3156
|
|
|
var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; |
|
3157
|
|
|
popper = _extends$1({}, popper, check[side](placement)); |
|
3158
|
|
|
}); |
|
3159
|
|
|
|
|
3160
|
|
|
data.offsets.popper = popper; |
|
3161
|
|
|
|
|
3162
|
|
|
return data; |
|
3163
|
|
|
} |
|
3164
|
|
|
|
|
3165
|
|
|
/** |
|
3166
|
|
|
* @function |
|
3167
|
|
|
* @memberof Modifiers |
|
3168
|
|
|
* @argument {Object} data - The data object generated by `update` method |
|
3169
|
|
|
* @argument {Object} options - Modifiers configuration and options |
|
3170
|
|
|
* @returns {Object} The data object, properly modified |
|
3171
|
|
|
*/ |
|
3172
|
|
|
function shift(data) { |
|
3173
|
|
|
var placement = data.placement; |
|
3174
|
|
|
var basePlacement = placement.split('-')[0]; |
|
3175
|
|
|
var shiftvariation = placement.split('-')[1]; |
|
3176
|
|
|
|
|
3177
|
|
|
// if shift shiftvariation is specified, run the modifier |
|
3178
|
|
|
if (shiftvariation) { |
|
3179
|
|
|
var _data$offsets = data.offsets, |
|
3180
|
|
|
reference = _data$offsets.reference, |
|
3181
|
|
|
popper = _data$offsets.popper; |
|
3182
|
|
|
|
|
3183
|
|
|
var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; |
|
3184
|
|
|
var side = isVertical ? 'left' : 'top'; |
|
3185
|
|
|
var measurement = isVertical ? 'width' : 'height'; |
|
3186
|
|
|
|
|
3187
|
|
|
var shiftOffsets = { |
|
3188
|
|
|
start: defineProperty({}, side, reference[side]), |
|
3189
|
|
|
end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) |
|
3190
|
|
|
}; |
|
3191
|
|
|
|
|
3192
|
|
|
data.offsets.popper = _extends$1({}, popper, shiftOffsets[shiftvariation]); |
|
3193
|
|
|
} |
|
3194
|
|
|
|
|
3195
|
|
|
return data; |
|
3196
|
|
|
} |
|
3197
|
|
|
|
|
3198
|
|
|
/** |
|
3199
|
|
|
* @function |
|
3200
|
|
|
* @memberof Modifiers |
|
3201
|
|
|
* @argument {Object} data - The data object generated by update method |
|
3202
|
|
|
* @argument {Object} options - Modifiers configuration and options |
|
3203
|
|
|
* @returns {Object} The data object, properly modified |
|
3204
|
|
|
*/ |
|
3205
|
|
|
function hide(data) { |
|
3206
|
|
|
if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { |
|
3207
|
|
|
return data; |
|
3208
|
|
|
} |
|
3209
|
|
|
|
|
3210
|
|
|
var refRect = data.offsets.reference; |
|
3211
|
|
|
var bound = find(data.instance.modifiers, function (modifier) { |
|
3212
|
|
|
return modifier.name === 'preventOverflow'; |
|
3213
|
|
|
}).boundaries; |
|
3214
|
|
|
|
|
3215
|
|
|
if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { |
|
3216
|
|
|
// Avoid unnecessary DOM access if visibility hasn't changed |
|
3217
|
|
|
if (data.hide === true) { |
|
3218
|
|
|
return data; |
|
3219
|
|
|
} |
|
3220
|
|
|
|
|
3221
|
|
|
data.hide = true; |
|
3222
|
|
|
data.attributes['x-out-of-boundaries'] = ''; |
|
3223
|
|
|
} else { |
|
3224
|
|
|
// Avoid unnecessary DOM access if visibility hasn't changed |
|
3225
|
|
|
if (data.hide === false) { |
|
3226
|
|
|
return data; |
|
3227
|
|
|
} |
|
3228
|
|
|
|
|
3229
|
|
|
data.hide = false; |
|
3230
|
|
|
data.attributes['x-out-of-boundaries'] = false; |
|
3231
|
|
|
} |
|
3232
|
|
|
|
|
3233
|
|
|
return data; |
|
3234
|
|
|
} |
|
3235
|
|
|
|
|
3236
|
|
|
/** |
|
3237
|
|
|
* @function |
|
3238
|
|
|
* @memberof Modifiers |
|
3239
|
|
|
* @argument {Object} data - The data object generated by `update` method |
|
3240
|
|
|
* @argument {Object} options - Modifiers configuration and options |
|
3241
|
|
|
* @returns {Object} The data object, properly modified |
|
3242
|
|
|
*/ |
|
3243
|
|
|
function inner(data) { |
|
3244
|
|
|
var placement = data.placement; |
|
3245
|
|
|
var basePlacement = placement.split('-')[0]; |
|
3246
|
|
|
var _data$offsets = data.offsets, |
|
3247
|
|
|
popper = _data$offsets.popper, |
|
3248
|
|
|
reference = _data$offsets.reference; |
|
3249
|
|
|
|
|
3250
|
|
|
var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; |
|
3251
|
|
|
|
|
3252
|
|
|
var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; |
|
3253
|
|
|
|
|
3254
|
|
|
popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); |
|
3255
|
|
|
|
|
3256
|
|
|
data.placement = getOppositePlacement(placement); |
|
3257
|
|
|
data.offsets.popper = getClientRect(popper); |
|
3258
|
|
|
|
|
3259
|
|
|
return data; |
|
3260
|
|
|
} |
|
3261
|
|
|
|
|
3262
|
|
|
/** |
|
3263
|
|
|
* Modifier function, each modifier can have a function of this type assigned |
|
3264
|
|
|
* to its `fn` property.<br /> |
|
3265
|
|
|
* These functions will be called on each update, this means that you must |
|
3266
|
|
|
* make sure they are performant enough to avoid performance bottlenecks. |
|
3267
|
|
|
* |
|
3268
|
|
|
* @function ModifierFn |
|
3269
|
|
|
* @argument {dataObject} data - The data object generated by `update` method |
|
3270
|
|
|
* @argument {Object} options - Modifiers configuration and options |
|
3271
|
|
|
* @returns {dataObject} The data object, properly modified |
|
3272
|
|
|
*/ |
|
3273
|
|
|
|
|
3274
|
|
|
/** |
|
3275
|
|
|
* Modifiers are plugins used to alter the behavior of your poppers.<br /> |
|
3276
|
|
|
* Popper.js uses a set of 9 modifiers to provide all the basic functionalities |
|
3277
|
|
|
* needed by the library. |
|
3278
|
|
|
* |
|
3279
|
|
|
* Usually you don't want to override the `order`, `fn` and `onLoad` props. |
|
3280
|
|
|
* All the other properties are configurations that could be tweaked. |
|
3281
|
|
|
* @namespace modifiers |
|
3282
|
|
|
*/ |
|
3283
|
|
|
var modifiers = { |
|
3284
|
|
|
/** |
|
3285
|
|
|
* Modifier used to shift the popper on the start or end of its reference |
|
3286
|
|
|
* element.<br /> |
|
3287
|
|
|
* It will read the variation of the `placement` property.<br /> |
|
3288
|
|
|
* It can be one either `-end` or `-start`. |
|
3289
|
|
|
* @memberof modifiers |
|
3290
|
|
|
* @inner |
|
3291
|
|
|
*/ |
|
3292
|
|
|
shift: { |
|
3293
|
|
|
/** @prop {number} order=100 - Index used to define the order of execution */ |
|
3294
|
|
|
order: 100, |
|
3295
|
|
|
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
|
3296
|
|
|
enabled: true, |
|
3297
|
|
|
/** @prop {ModifierFn} */ |
|
3298
|
|
|
fn: shift |
|
3299
|
|
|
}, |
|
3300
|
|
|
|
|
3301
|
|
|
/** |
|
3302
|
|
|
* The `offset` modifier can shift your popper on both its axis. |
|
3303
|
|
|
* |
|
3304
|
|
|
* It accepts the following units: |
|
3305
|
|
|
* - `px` or unitless, interpreted as pixels |
|
3306
|
|
|
* - `%` or `%r`, percentage relative to the length of the reference element |
|
3307
|
|
|
* - `%p`, percentage relative to the length of the popper element |
|
3308
|
|
|
* - `vw`, CSS viewport width unit |
|
3309
|
|
|
* - `vh`, CSS viewport height unit |
|
3310
|
|
|
* |
|
3311
|
|
|
* For length is intended the main axis relative to the placement of the popper.<br /> |
|
3312
|
|
|
* This means that if the placement is `top` or `bottom`, the length will be the |
|
3313
|
|
|
* `width`. In case of `left` or `right`, it will be the height. |
|
3314
|
|
|
* |
|
3315
|
|
|
* You can provide a single value (as `Number` or `String`), or a pair of values |
|
3316
|
|
|
* as `String` divided by a comma or one (or more) white spaces.<br /> |
|
3317
|
|
|
* The latter is a deprecated method because it leads to confusion and will be |
|
3318
|
|
|
* removed in v2.<br /> |
|
3319
|
|
|
* Additionally, it accepts additions and subtractions between different units. |
|
3320
|
|
|
* Note that multiplications and divisions aren't supported. |
|
3321
|
|
|
* |
|
3322
|
|
|
* Valid examples are: |
|
3323
|
|
|
* ``` |
|
3324
|
|
|
* 10 |
|
3325
|
|
|
* '10%' |
|
3326
|
|
|
* '10, 10' |
|
3327
|
|
|
* '10%, 10' |
|
3328
|
|
|
* '10 + 10%' |
|
3329
|
|
|
* '10 - 5vh + 3%' |
|
3330
|
|
|
* '-10px + 5vh, 5px - 6%' |
|
3331
|
|
|
* ``` |
|
3332
|
|
|
* > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap |
|
3333
|
|
|
* > with their reference element, unfortunately, you will have to disable the `flip` modifier. |
|
3334
|
|
|
* > More on this [reading this issue](https://github.com/FezVrasta/popper.js/issues/373) |
|
3335
|
|
|
* |
|
3336
|
|
|
* @memberof modifiers |
|
3337
|
|
|
* @inner |
|
3338
|
|
|
*/ |
|
3339
|
|
|
offset: { |
|
3340
|
|
|
/** @prop {number} order=200 - Index used to define the order of execution */ |
|
3341
|
|
|
order: 200, |
|
3342
|
|
|
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
|
3343
|
|
|
enabled: true, |
|
3344
|
|
|
/** @prop {ModifierFn} */ |
|
3345
|
|
|
fn: offset, |
|
3346
|
|
|
/** @prop {Number|String} offset=0 |
|
3347
|
|
|
* The offset value as described in the modifier description |
|
3348
|
|
|
*/ |
|
3349
|
|
|
offset: 0 |
|
3350
|
|
|
}, |
|
3351
|
|
|
|
|
3352
|
|
|
/** |
|
3353
|
|
|
* Modifier used to prevent the popper from being positioned outside the boundary. |
|
3354
|
|
|
* |
|
3355
|
|
|
* An scenario exists where the reference itself is not within the boundaries.<br /> |
|
3356
|
|
|
* We can say it has "escaped the boundaries" — or just "escaped".<br /> |
|
3357
|
|
|
* In this case we need to decide whether the popper should either: |
|
3358
|
|
|
* |
|
3359
|
|
|
* - detach from the reference and remain "trapped" in the boundaries, or |
|
3360
|
|
|
* - if it should ignore the boundary and "escape with its reference" |
|
3361
|
|
|
* |
|
3362
|
|
|
* When `escapeWithReference` is set to`true` and reference is completely |
|
3363
|
|
|
* outside its boundaries, the popper will overflow (or completely leave) |
|
3364
|
|
|
* the boundaries in order to remain attached to the edge of the reference. |
|
3365
|
|
|
* |
|
3366
|
|
|
* @memberof modifiers |
|
3367
|
|
|
* @inner |
|
3368
|
|
|
*/ |
|
3369
|
|
|
preventOverflow: { |
|
3370
|
|
|
/** @prop {number} order=300 - Index used to define the order of execution */ |
|
3371
|
|
|
order: 300, |
|
3372
|
|
|
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
|
3373
|
|
|
enabled: true, |
|
3374
|
|
|
/** @prop {ModifierFn} */ |
|
3375
|
|
|
fn: preventOverflow, |
|
3376
|
|
|
/** |
|
3377
|
|
|
* @prop {Array} [priority=['left','right','top','bottom']] |
|
3378
|
|
|
* Popper will try to prevent overflow following these priorities by default, |
|
3379
|
|
|
* then, it could overflow on the left and on top of the `boundariesElement` |
|
3380
|
|
|
*/ |
|
3381
|
|
|
priority: ['left', 'right', 'top', 'bottom'], |
|
3382
|
|
|
/** |
|
3383
|
|
|
* @prop {number} padding=5 |
|
3384
|
|
|
* Amount of pixel used to define a minimum distance between the boundaries |
|
3385
|
|
|
* and the popper this makes sure the popper has always a little padding |
|
3386
|
|
|
* between the edges of its container |
|
3387
|
|
|
*/ |
|
3388
|
|
|
padding: 5, |
|
3389
|
|
|
/** |
|
3390
|
|
|
* @prop {String|HTMLElement} boundariesElement='scrollParent' |
|
3391
|
|
|
* Boundaries used by the modifier, can be `scrollParent`, `window`, |
|
3392
|
|
|
* `viewport` or any DOM element. |
|
3393
|
|
|
*/ |
|
3394
|
|
|
boundariesElement: 'scrollParent' |
|
3395
|
|
|
}, |
|
3396
|
|
|
|
|
3397
|
|
|
/** |
|
3398
|
|
|
* Modifier used to make sure the reference and its popper stay near eachothers |
|
3399
|
|
|
* without leaving any gap between the two. Expecially useful when the arrow is |
|
3400
|
|
|
* enabled and you want to assure it to point to its reference element. |
|
3401
|
|
|
* It cares only about the first axis, you can still have poppers with margin |
|
3402
|
|
|
* between the popper and its reference element. |
|
3403
|
|
|
* @memberof modifiers |
|
3404
|
|
|
* @inner |
|
3405
|
|
|
*/ |
|
3406
|
|
|
keepTogether: { |
|
3407
|
|
|
/** @prop {number} order=400 - Index used to define the order of execution */ |
|
3408
|
|
|
order: 400, |
|
3409
|
|
|
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
|
3410
|
|
|
enabled: true, |
|
3411
|
|
|
/** @prop {ModifierFn} */ |
|
3412
|
|
|
fn: keepTogether |
|
3413
|
|
|
}, |
|
3414
|
|
|
|
|
3415
|
|
|
/** |
|
3416
|
|
|
* This modifier is used to move the `arrowElement` of the popper to make |
|
3417
|
|
|
* sure it is positioned between the reference element and its popper element. |
|
3418
|
|
|
* It will read the outer size of the `arrowElement` node to detect how many |
|
3419
|
|
|
* pixels of conjuction are needed. |
|
3420
|
|
|
* |
|
3421
|
|
|
* It has no effect if no `arrowElement` is provided. |
|
3422
|
|
|
* @memberof modifiers |
|
3423
|
|
|
* @inner |
|
3424
|
|
|
*/ |
|
3425
|
|
|
arrow: { |
|
3426
|
|
|
/** @prop {number} order=500 - Index used to define the order of execution */ |
|
3427
|
|
|
order: 500, |
|
3428
|
|
|
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
|
3429
|
|
|
enabled: true, |
|
3430
|
|
|
/** @prop {ModifierFn} */ |
|
3431
|
|
|
fn: arrow, |
|
3432
|
|
|
/** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ |
|
3433
|
|
|
element: '[x-arrow]' |
|
3434
|
|
|
}, |
|
3435
|
|
|
|
|
3436
|
|
|
/** |
|
3437
|
|
|
* Modifier used to flip the popper's placement when it starts to overlap its |
|
3438
|
|
|
* reference element. |
|
3439
|
|
|
* |
|
3440
|
|
|
* Requires the `preventOverflow` modifier before it in order to work. |
|
3441
|
|
|
* |
|
3442
|
|
|
* **NOTE:** this modifier will interrupt the current update cycle and will |
|
3443
|
|
|
* restart it if it detects the need to flip the placement. |
|
3444
|
|
|
* @memberof modifiers |
|
3445
|
|
|
* @inner |
|
3446
|
|
|
*/ |
|
3447
|
|
|
flip: { |
|
3448
|
|
|
/** @prop {number} order=600 - Index used to define the order of execution */ |
|
3449
|
|
|
order: 600, |
|
3450
|
|
|
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
|
3451
|
|
|
enabled: true, |
|
3452
|
|
|
/** @prop {ModifierFn} */ |
|
3453
|
|
|
fn: flip, |
|
3454
|
|
|
/** |
|
3455
|
|
|
* @prop {String|Array} behavior='flip' |
|
3456
|
|
|
* The behavior used to change the popper's placement. It can be one of |
|
3457
|
|
|
* `flip`, `clockwise`, `counterclockwise` or an array with a list of valid |
|
3458
|
|
|
* placements (with optional variations). |
|
3459
|
|
|
*/ |
|
3460
|
|
|
behavior: 'flip', |
|
3461
|
|
|
/** |
|
3462
|
|
|
* @prop {number} padding=5 |
|
3463
|
|
|
* The popper will flip if it hits the edges of the `boundariesElement` |
|
3464
|
|
|
*/ |
|
3465
|
|
|
padding: 5, |
|
3466
|
|
|
/** |
|
3467
|
|
|
* @prop {String|HTMLElement} boundariesElement='viewport' |
|
3468
|
|
|
* The element which will define the boundaries of the popper position, |
|
3469
|
|
|
* the popper will never be placed outside of the defined boundaries |
|
3470
|
|
|
* (except if keepTogether is enabled) |
|
3471
|
|
|
*/ |
|
3472
|
|
|
boundariesElement: 'viewport' |
|
3473
|
|
|
}, |
|
3474
|
|
|
|
|
3475
|
|
|
/** |
|
3476
|
|
|
* Modifier used to make the popper flow toward the inner of the reference element. |
|
3477
|
|
|
* By default, when this modifier is disabled, the popper will be placed outside |
|
3478
|
|
|
* the reference element. |
|
3479
|
|
|
* @memberof modifiers |
|
3480
|
|
|
* @inner |
|
3481
|
|
|
*/ |
|
3482
|
|
|
inner: { |
|
3483
|
|
|
/** @prop {number} order=700 - Index used to define the order of execution */ |
|
3484
|
|
|
order: 700, |
|
3485
|
|
|
/** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ |
|
3486
|
|
|
enabled: false, |
|
3487
|
|
|
/** @prop {ModifierFn} */ |
|
3488
|
|
|
fn: inner |
|
3489
|
|
|
}, |
|
3490
|
|
|
|
|
3491
|
|
|
/** |
|
3492
|
|
|
* Modifier used to hide the popper when its reference element is outside of the |
|
3493
|
|
|
* popper boundaries. It will set a `x-out-of-boundaries` attribute which can |
|
3494
|
|
|
* be used to hide with a CSS selector the popper when its reference is |
|
3495
|
|
|
* out of boundaries. |
|
3496
|
|
|
* |
|
3497
|
|
|
* Requires the `preventOverflow` modifier before it in order to work. |
|
3498
|
|
|
* @memberof modifiers |
|
3499
|
|
|
* @inner |
|
3500
|
|
|
*/ |
|
3501
|
|
|
hide: { |
|
3502
|
|
|
/** @prop {number} order=800 - Index used to define the order of execution */ |
|
3503
|
|
|
order: 800, |
|
3504
|
|
|
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
|
3505
|
|
|
enabled: true, |
|
3506
|
|
|
/** @prop {ModifierFn} */ |
|
3507
|
|
|
fn: hide |
|
3508
|
|
|
}, |
|
3509
|
|
|
|
|
3510
|
|
|
/** |
|
3511
|
|
|
* Computes the style that will be applied to the popper element to gets |
|
3512
|
|
|
* properly positioned. |
|
3513
|
|
|
* |
|
3514
|
|
|
* Note that this modifier will not touch the DOM, it just prepares the styles |
|
3515
|
|
|
* so that `applyStyle` modifier can apply it. This separation is useful |
|
3516
|
|
|
* in case you need to replace `applyStyle` with a custom implementation. |
|
3517
|
|
|
* |
|
3518
|
|
|
* This modifier has `850` as `order` value to maintain backward compatibility |
|
3519
|
|
|
* with previous versions of Popper.js. Expect the modifiers ordering method |
|
3520
|
|
|
* to change in future major versions of the library. |
|
3521
|
|
|
* |
|
3522
|
|
|
* @memberof modifiers |
|
3523
|
|
|
* @inner |
|
3524
|
|
|
*/ |
|
3525
|
|
|
computeStyle: { |
|
3526
|
|
|
/** @prop {number} order=850 - Index used to define the order of execution */ |
|
3527
|
|
|
order: 850, |
|
3528
|
|
|
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
|
3529
|
|
|
enabled: true, |
|
3530
|
|
|
/** @prop {ModifierFn} */ |
|
3531
|
|
|
fn: computeStyle, |
|
3532
|
|
|
/** |
|
3533
|
|
|
* @prop {Boolean} gpuAcceleration=true |
|
3534
|
|
|
* If true, it uses the CSS 3d transformation to position the popper. |
|
3535
|
|
|
* Otherwise, it will use the `top` and `left` properties. |
|
3536
|
|
|
*/ |
|
3537
|
|
|
gpuAcceleration: true, |
|
3538
|
|
|
/** |
|
3539
|
|
|
* @prop {string} [x='bottom'] |
|
3540
|
|
|
* Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. |
|
3541
|
|
|
* Change this if your popper should grow in a direction different from `bottom` |
|
3542
|
|
|
*/ |
|
3543
|
|
|
x: 'bottom', |
|
3544
|
|
|
/** |
|
3545
|
|
|
* @prop {string} [x='left'] |
|
3546
|
|
|
* Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. |
|
3547
|
|
|
* Change this if your popper should grow in a direction different from `right` |
|
3548
|
|
|
*/ |
|
3549
|
|
|
y: 'right' |
|
3550
|
|
|
}, |
|
3551
|
|
|
|
|
3552
|
|
|
/** |
|
3553
|
|
|
* Applies the computed styles to the popper element. |
|
3554
|
|
|
* |
|
3555
|
|
|
* All the DOM manipulations are limited to this modifier. This is useful in case |
|
3556
|
|
|
* you want to integrate Popper.js inside a framework or view library and you |
|
3557
|
|
|
* want to delegate all the DOM manipulations to it. |
|
3558
|
|
|
* |
|
3559
|
|
|
* Note that if you disable this modifier, you must make sure the popper element |
|
3560
|
|
|
* has its position set to `absolute` before Popper.js can do its work! |
|
3561
|
|
|
* |
|
3562
|
|
|
* Just disable this modifier and define you own to achieve the desired effect. |
|
3563
|
|
|
* |
|
3564
|
|
|
* @memberof modifiers |
|
3565
|
|
|
* @inner |
|
3566
|
|
|
*/ |
|
3567
|
|
|
applyStyle: { |
|
3568
|
|
|
/** @prop {number} order=900 - Index used to define the order of execution */ |
|
3569
|
|
|
order: 900, |
|
3570
|
|
|
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
|
3571
|
|
|
enabled: true, |
|
3572
|
|
|
/** @prop {ModifierFn} */ |
|
3573
|
|
|
fn: applyStyle, |
|
3574
|
|
|
/** @prop {Function} */ |
|
3575
|
|
|
onLoad: applyStyleOnLoad, |
|
3576
|
|
|
/** |
|
3577
|
|
|
* @deprecated since version 1.10.0, the property moved to `computeStyle` modifier |
|
3578
|
|
|
* @prop {Boolean} gpuAcceleration=true |
|
3579
|
|
|
* If true, it uses the CSS 3d transformation to position the popper. |
|
3580
|
|
|
* Otherwise, it will use the `top` and `left` properties. |
|
3581
|
|
|
*/ |
|
3582
|
|
|
gpuAcceleration: undefined |
|
3583
|
|
|
} |
|
3584
|
|
|
}; |
|
3585
|
|
|
|
|
3586
|
|
|
/** |
|
3587
|
|
|
* The `dataObject` is an object containing all the informations used by Popper.js |
|
3588
|
|
|
* this object get passed to modifiers and to the `onCreate` and `onUpdate` callbacks. |
|
3589
|
|
|
* @name dataObject |
|
3590
|
|
|
* @property {Object} data.instance The Popper.js instance |
|
3591
|
|
|
* @property {String} data.placement Placement applied to popper |
|
3592
|
|
|
* @property {String} data.originalPlacement Placement originally defined on init |
|
3593
|
|
|
* @property {Boolean} data.flipped True if popper has been flipped by flip modifier |
|
3594
|
|
|
* @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper. |
|
3595
|
|
|
* @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier |
|
3596
|
|
|
* @property {Object} data.styles Any CSS property defined here will be applied to the popper, it expects the JavaScript nomenclature (eg. `marginBottom`) |
|
3597
|
|
|
* @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow, it expects the JavaScript nomenclature (eg. `marginBottom`) |
|
3598
|
|
|
* @property {Object} data.boundaries Offsets of the popper boundaries |
|
3599
|
|
|
* @property {Object} data.offsets The measurements of popper, reference and arrow elements. |
|
3600
|
|
|
* @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values |
|
3601
|
|
|
* @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values |
|
3602
|
|
|
* @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 |
|
3603
|
|
|
*/ |
|
3604
|
|
|
|
|
3605
|
|
|
/** |
|
3606
|
|
|
* Default options provided to Popper.js constructor.<br /> |
|
3607
|
|
|
* These can be overriden using the `options` argument of Popper.js.<br /> |
|
3608
|
|
|
* To override an option, simply pass as 3rd argument an object with the same |
|
3609
|
|
|
* structure of this object, example: |
|
3610
|
|
|
* ``` |
|
3611
|
|
|
* new Popper(ref, pop, { |
|
3612
|
|
|
* modifiers: { |
|
3613
|
|
|
* preventOverflow: { enabled: false } |
|
3614
|
|
|
* } |
|
3615
|
|
|
* }) |
|
3616
|
|
|
* ``` |
|
3617
|
|
|
* @type {Object} |
|
3618
|
|
|
* @static |
|
3619
|
|
|
* @memberof Popper |
|
3620
|
|
|
*/ |
|
3621
|
|
|
var Defaults = { |
|
3622
|
|
|
/** |
|
3623
|
|
|
* Popper's placement |
|
3624
|
|
|
* @prop {Popper.placements} placement='bottom' |
|
3625
|
|
|
*/ |
|
3626
|
|
|
placement: 'bottom', |
|
3627
|
|
|
|
|
3628
|
|
|
/** |
|
3629
|
|
|
* Whether events (resize, scroll) are initially enabled |
|
3630
|
|
|
* @prop {Boolean} eventsEnabled=true |
|
3631
|
|
|
*/ |
|
3632
|
|
|
eventsEnabled: true, |
|
3633
|
|
|
|
|
3634
|
|
|
/** |
|
3635
|
|
|
* Set to true if you want to automatically remove the popper when |
|
3636
|
|
|
* you call the `destroy` method. |
|
3637
|
|
|
* @prop {Boolean} removeOnDestroy=false |
|
3638
|
|
|
*/ |
|
3639
|
|
|
removeOnDestroy: false, |
|
3640
|
|
|
|
|
3641
|
|
|
/** |
|
3642
|
|
|
* Callback called when the popper is created.<br /> |
|
3643
|
|
|
* By default, is set to no-op.<br /> |
|
3644
|
|
|
* Access Popper.js instance with `data.instance`. |
|
3645
|
|
|
* @prop {onCreate} |
|
3646
|
|
|
*/ |
|
3647
|
|
|
onCreate: function onCreate() {}, |
|
3648
|
|
|
|
|
3649
|
|
|
/** |
|
3650
|
|
|
* Callback called when the popper is updated, this callback is not called |
|
3651
|
|
|
* on the initialization/creation of the popper, but only on subsequent |
|
3652
|
|
|
* updates.<br /> |
|
3653
|
|
|
* By default, is set to no-op.<br /> |
|
3654
|
|
|
* Access Popper.js instance with `data.instance`. |
|
3655
|
|
|
* @prop {onUpdate} |
|
3656
|
|
|
*/ |
|
3657
|
|
|
onUpdate: function onUpdate() {}, |
|
3658
|
|
|
|
|
3659
|
|
|
/** |
|
3660
|
|
|
* List of modifiers used to modify the offsets before they are applied to the popper. |
|
3661
|
|
|
* They provide most of the functionalities of Popper.js |
|
3662
|
|
|
* @prop {modifiers} |
|
3663
|
|
|
*/ |
|
3664
|
|
|
modifiers: modifiers |
|
3665
|
|
|
}; |
|
3666
|
|
|
|
|
3667
|
|
|
/** |
|
3668
|
|
|
* @callback onCreate |
|
3669
|
|
|
* @param {dataObject} data |
|
3670
|
|
|
*/ |
|
3671
|
|
|
|
|
3672
|
|
|
/** |
|
3673
|
|
|
* @callback onUpdate |
|
3674
|
|
|
* @param {dataObject} data |
|
3675
|
|
|
*/ |
|
3676
|
|
|
|
|
3677
|
|
|
// Utils |
|
3678
|
|
|
// Methods |
|
3679
|
|
|
var Popper = function () { |
|
3680
|
|
|
/** |
|
3681
|
|
|
* Create a new Popper.js instance |
|
3682
|
|
|
* @class Popper |
|
3683
|
|
|
* @param {HTMLElement|referenceObject} reference - The reference element used to position the popper |
|
3684
|
|
|
* @param {HTMLElement} popper - The HTML element used as popper. |
|
3685
|
|
|
* @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) |
|
3686
|
|
|
* @return {Object} instance - The generated Popper.js instance |
|
3687
|
|
|
*/ |
|
3688
|
|
|
function Popper(reference, popper) { |
|
3689
|
|
|
var _this = this; |
|
3690
|
|
|
|
|
3691
|
|
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
|
3692
|
|
|
classCallCheck(this, Popper); |
|
3693
|
|
|
|
|
3694
|
|
|
this.scheduleUpdate = function () { |
|
3695
|
|
|
return requestAnimationFrame(_this.update); |
|
3696
|
|
|
}; |
|
3697
|
|
|
|
|
3698
|
|
|
// make update() debounced, so that it only runs at most once-per-tick |
|
3699
|
|
|
this.update = debounce(this.update.bind(this)); |
|
3700
|
|
|
|
|
3701
|
|
|
// with {} we create a new object with the options inside it |
|
3702
|
|
|
this.options = _extends$1({}, Popper.Defaults, options); |
|
3703
|
|
|
|
|
3704
|
|
|
// init state |
|
3705
|
|
|
this.state = { |
|
3706
|
|
|
isDestroyed: false, |
|
3707
|
|
|
isCreated: false, |
|
3708
|
|
|
scrollParents: [] |
|
3709
|
|
|
}; |
|
3710
|
|
|
|
|
3711
|
|
|
// get reference and popper elements (allow jQuery wrappers) |
|
3712
|
|
|
this.reference = reference && reference.jquery ? reference[0] : reference; |
|
3713
|
|
|
this.popper = popper && popper.jquery ? popper[0] : popper; |
|
3714
|
|
|
|
|
3715
|
|
|
// Deep merge modifiers options |
|
3716
|
|
|
this.options.modifiers = {}; |
|
3717
|
|
|
Object.keys(_extends$1({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { |
|
3718
|
|
|
_this.options.modifiers[name] = _extends$1({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); |
|
3719
|
|
|
}); |
|
3720
|
|
|
|
|
3721
|
|
|
// Refactoring modifiers' list (Object => Array) |
|
3722
|
|
|
this.modifiers = Object.keys(this.options.modifiers).map(function (name) { |
|
3723
|
|
|
return _extends$1({ |
|
3724
|
|
|
name: name |
|
3725
|
|
|
}, _this.options.modifiers[name]); |
|
3726
|
|
|
}) |
|
3727
|
|
|
// sort the modifiers by order |
|
3728
|
|
|
.sort(function (a, b) { |
|
3729
|
|
|
return a.order - b.order; |
|
3730
|
|
|
}); |
|
3731
|
|
|
|
|
3732
|
|
|
// modifiers have the ability to execute arbitrary code when Popper.js get inited |
|
3733
|
|
|
// such code is executed in the same order of its modifier |
|
3734
|
|
|
// they could add new properties to their options configuration |
|
3735
|
|
|
// BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! |
|
3736
|
|
|
this.modifiers.forEach(function (modifierOptions) { |
|
3737
|
|
|
if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { |
|
3738
|
|
|
modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); |
|
3739
|
|
|
} |
|
3740
|
|
|
}); |
|
3741
|
|
|
|
|
3742
|
|
|
// fire the first update to position the popper in the right place |
|
3743
|
|
|
this.update(); |
|
3744
|
|
|
|
|
3745
|
|
|
var eventsEnabled = this.options.eventsEnabled; |
|
3746
|
|
|
if (eventsEnabled) { |
|
3747
|
|
|
// setup event listeners, they will take care of update the position in specific situations |
|
3748
|
|
|
this.enableEventListeners(); |
|
3749
|
|
|
} |
|
3750
|
|
|
|
|
3751
|
|
|
this.state.eventsEnabled = eventsEnabled; |
|
3752
|
|
|
} |
|
3753
|
|
|
|
|
3754
|
|
|
// We can't use class properties because they don't get listed in the |
|
3755
|
|
|
// class prototype and break stuff like Sinon stubs |
|
3756
|
|
|
|
|
3757
|
|
|
|
|
3758
|
|
|
createClass(Popper, [{ |
|
3759
|
|
|
key: 'update', |
|
3760
|
|
|
value: function update$$1() { |
|
3761
|
|
|
return update.call(this); |
|
3762
|
|
|
} |
|
3763
|
|
|
}, { |
|
3764
|
|
|
key: 'destroy', |
|
3765
|
|
|
value: function destroy$$1() { |
|
3766
|
|
|
return destroy.call(this); |
|
3767
|
|
|
} |
|
3768
|
|
|
}, { |
|
3769
|
|
|
key: 'enableEventListeners', |
|
3770
|
|
|
value: function enableEventListeners$$1() { |
|
3771
|
|
|
return enableEventListeners.call(this); |
|
3772
|
|
|
} |
|
3773
|
|
|
}, { |
|
3774
|
|
|
key: 'disableEventListeners', |
|
3775
|
|
|
value: function disableEventListeners$$1() { |
|
3776
|
|
|
return disableEventListeners.call(this); |
|
3777
|
|
|
} |
|
3778
|
|
|
|
|
3779
|
|
|
/** |
|
3780
|
|
|
* Schedule an update, it will run on the next UI update available |
|
3781
|
|
|
* @method scheduleUpdate |
|
3782
|
|
|
* @memberof Popper |
|
3783
|
|
|
*/ |
|
3784
|
|
|
|
|
3785
|
|
|
|
|
3786
|
|
|
/** |
|
3787
|
|
|
* Collection of utilities useful when writing custom modifiers. |
|
3788
|
|
|
* Starting from version 1.7, this method is available only if you |
|
3789
|
|
|
* include `popper-utils.js` before `popper.js`. |
|
3790
|
|
|
* |
|
3791
|
|
|
* **DEPRECATION**: This way to access PopperUtils is deprecated |
|
3792
|
|
|
* and will be removed in v2! Use the PopperUtils module directly instead. |
|
3793
|
|
|
* Due to the high instability of the methods contained in Utils, we can't |
|
3794
|
|
|
* guarantee them to follow semver. Use them at your own risk! |
|
3795
|
|
|
* @static |
|
3796
|
|
|
* @private |
|
3797
|
|
|
* @type {Object} |
|
3798
|
|
|
* @deprecated since version 1.8 |
|
3799
|
|
|
* @member Utils |
|
3800
|
|
|
* @memberof Popper |
|
3801
|
|
|
*/ |
|
3802
|
|
|
|
|
3803
|
|
|
}]); |
|
3804
|
|
|
return Popper; |
|
3805
|
|
|
}(); |
|
3806
|
|
|
|
|
3807
|
|
|
/** |
|
3808
|
|
|
* The `referenceObject` is an object that provides an interface compatible with Popper.js |
|
3809
|
|
|
* and lets you use it as replacement of a real DOM node.<br /> |
|
3810
|
|
|
* You can use this method to position a popper relatively to a set of coordinates |
|
3811
|
|
|
* in case you don't have a DOM node to use as reference. |
|
3812
|
|
|
* |
|
3813
|
|
|
* ``` |
|
3814
|
|
|
* new Popper(referenceObject, popperNode); |
|
3815
|
|
|
* ``` |
|
3816
|
|
|
* |
|
3817
|
|
|
* NB: This feature isn't supported in Internet Explorer 10 |
|
3818
|
|
|
* @name referenceObject |
|
3819
|
|
|
* @property {Function} data.getBoundingClientRect |
|
3820
|
|
|
* A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. |
|
3821
|
|
|
* @property {number} data.clientWidth |
|
3822
|
|
|
* An ES6 getter that will return the width of the virtual reference element. |
|
3823
|
|
|
* @property {number} data.clientHeight |
|
3824
|
|
|
* An ES6 getter that will return the height of the virtual reference element. |
|
3825
|
|
|
*/ |
|
3826
|
|
|
|
|
3827
|
|
|
|
|
3828
|
|
|
Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; |
|
3829
|
|
|
Popper.placements = placements; |
|
3830
|
|
|
Popper.Defaults = Defaults; |
|
3831
|
|
|
|
|
3832
|
|
|
/** |
|
3833
|
|
|
* -------------------------------------------------------------------------- |
|
3834
|
|
|
* Bootstrap (v4.0.0): dropdown.js |
|
3835
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
3836
|
|
|
* -------------------------------------------------------------------------- |
|
3837
|
|
|
*/ |
|
3838
|
|
|
|
|
3839
|
|
|
var Dropdown = function ($$$1) { |
|
3840
|
|
|
/** |
|
3841
|
|
|
* ------------------------------------------------------------------------ |
|
3842
|
|
|
* Constants |
|
3843
|
|
|
* ------------------------------------------------------------------------ |
|
3844
|
|
|
*/ |
|
3845
|
|
|
var NAME = 'dropdown'; |
|
3846
|
|
|
var VERSION = '4.0.0'; |
|
3847
|
|
|
var DATA_KEY = 'bs.dropdown'; |
|
3848
|
|
|
var EVENT_KEY = "." + DATA_KEY; |
|
3849
|
|
|
var DATA_API_KEY = '.data-api'; |
|
3850
|
|
|
var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; |
|
3851
|
|
|
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key |
|
3852
|
|
|
|
|
3853
|
|
|
var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key |
|
3854
|
|
|
|
|
3855
|
|
|
var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key |
|
3856
|
|
|
|
|
3857
|
|
|
var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key |
|
3858
|
|
|
|
|
3859
|
|
|
var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key |
|
3860
|
|
|
|
|
3861
|
|
|
var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) |
|
3862
|
|
|
|
|
3863
|
|
|
var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE); |
|
3864
|
|
|
var Event = { |
|
3865
|
|
|
HIDE: "hide" + EVENT_KEY, |
|
3866
|
|
|
HIDDEN: "hidden" + EVENT_KEY, |
|
3867
|
|
|
SHOW: "show" + EVENT_KEY, |
|
3868
|
|
|
SHOWN: "shown" + EVENT_KEY, |
|
3869
|
|
|
CLICK: "click" + EVENT_KEY, |
|
3870
|
|
|
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY, |
|
3871
|
|
|
KEYDOWN_DATA_API: "keydown" + EVENT_KEY + DATA_API_KEY, |
|
3872
|
|
|
KEYUP_DATA_API: "keyup" + EVENT_KEY + DATA_API_KEY |
|
3873
|
|
|
}; |
|
3874
|
|
|
var ClassName = { |
|
3875
|
|
|
DISABLED: 'disabled', |
|
3876
|
|
|
SHOW: 'show', |
|
3877
|
|
|
DROPUP: 'dropup', |
|
3878
|
|
|
DROPRIGHT: 'dropright', |
|
3879
|
|
|
DROPLEFT: 'dropleft', |
|
3880
|
|
|
MENURIGHT: 'dropdown-menu-right', |
|
3881
|
|
|
MENULEFT: 'dropdown-menu-left', |
|
3882
|
|
|
POSITION_STATIC: 'position-static' |
|
3883
|
|
|
}; |
|
3884
|
|
|
var Selector = { |
|
3885
|
|
|
DATA_TOGGLE: '[data-toggle="dropdown"]', |
|
3886
|
|
|
FORM_CHILD: '.dropdown form', |
|
3887
|
|
|
MENU: '.dropdown-menu', |
|
3888
|
|
|
NAVBAR_NAV: '.navbar-nav', |
|
3889
|
|
|
VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled)' |
|
3890
|
|
|
}; |
|
3891
|
|
|
var AttachmentMap = { |
|
3892
|
|
|
TOP: 'top-start', |
|
3893
|
|
|
TOPEND: 'top-end', |
|
3894
|
|
|
BOTTOM: 'bottom-start', |
|
3895
|
|
|
BOTTOMEND: 'bottom-end', |
|
3896
|
|
|
RIGHT: 'right-start', |
|
3897
|
|
|
RIGHTEND: 'right-end', |
|
3898
|
|
|
LEFT: 'left-start', |
|
3899
|
|
|
LEFTEND: 'left-end' |
|
3900
|
|
|
}; |
|
3901
|
|
|
var Default = { |
|
3902
|
|
|
offset: 0, |
|
3903
|
|
|
flip: true, |
|
3904
|
|
|
boundary: 'scrollParent' |
|
3905
|
|
|
}; |
|
3906
|
|
|
var DefaultType = { |
|
3907
|
|
|
offset: '(number|string|function)', |
|
3908
|
|
|
flip: 'boolean', |
|
3909
|
|
|
boundary: '(string|element)' |
|
3910
|
|
|
/** |
|
3911
|
|
|
* ------------------------------------------------------------------------ |
|
3912
|
|
|
* Class Definition |
|
3913
|
|
|
* ------------------------------------------------------------------------ |
|
3914
|
|
|
*/ |
|
3915
|
|
|
|
|
3916
|
|
|
}; |
|
3917
|
|
|
|
|
3918
|
|
|
var Dropdown = |
|
3919
|
|
|
/*#__PURE__*/ |
|
3920
|
|
|
function () { |
|
3921
|
|
|
function Dropdown(element, config) { |
|
3922
|
|
|
this._element = element; |
|
3923
|
|
|
this._popper = null; |
|
3924
|
|
|
this._config = this._getConfig(config); |
|
3925
|
|
|
this._menu = this._getMenuElement(); |
|
3926
|
|
|
this._inNavbar = this._detectNavbar(); |
|
3927
|
|
|
|
|
3928
|
|
|
this._addEventListeners(); |
|
3929
|
|
|
} // Getters |
|
3930
|
|
|
|
|
3931
|
|
|
|
|
3932
|
|
|
var _proto = Dropdown.prototype; |
|
3933
|
|
|
|
|
3934
|
|
|
// Public |
|
3935
|
|
|
_proto.toggle = function toggle() { |
|
3936
|
|
|
if (this._element.disabled || $$$1(this._element).hasClass(ClassName.DISABLED)) { |
|
3937
|
|
|
return; |
|
3938
|
|
|
} |
|
3939
|
|
|
|
|
3940
|
|
|
var parent = Dropdown._getParentFromElement(this._element); |
|
3941
|
|
|
|
|
3942
|
|
|
var isActive = $$$1(this._menu).hasClass(ClassName.SHOW); |
|
3943
|
|
|
|
|
3944
|
|
|
Dropdown._clearMenus(); |
|
3945
|
|
|
|
|
3946
|
|
|
if (isActive) { |
|
3947
|
|
|
return; |
|
3948
|
|
|
} |
|
3949
|
|
|
|
|
3950
|
|
|
var relatedTarget = { |
|
3951
|
|
|
relatedTarget: this._element |
|
3952
|
|
|
}; |
|
3953
|
|
|
var showEvent = $$$1.Event(Event.SHOW, relatedTarget); |
|
3954
|
|
|
$$$1(parent).trigger(showEvent); |
|
3955
|
|
|
|
|
3956
|
|
|
if (showEvent.isDefaultPrevented()) { |
|
3957
|
|
|
return; |
|
3958
|
|
|
} // Disable totally Popper.js for Dropdown in Navbar |
|
3959
|
|
|
|
|
3960
|
|
|
|
|
3961
|
|
|
if (!this._inNavbar) { |
|
3962
|
|
|
/** |
|
3963
|
|
|
* Check for Popper dependency |
|
3964
|
|
|
* Popper - https://popper.js.org |
|
3965
|
|
|
*/ |
|
3966
|
|
|
if (typeof Popper === 'undefined') { |
|
3967
|
|
|
throw new TypeError('Bootstrap dropdown require Popper.js (https://popper.js.org)'); |
|
3968
|
|
|
} |
|
3969
|
|
|
|
|
3970
|
|
|
var element = this._element; // For dropup with alignment we use the parent as popper container |
|
3971
|
|
|
|
|
3972
|
|
|
if ($$$1(parent).hasClass(ClassName.DROPUP)) { |
|
3973
|
|
|
if ($$$1(this._menu).hasClass(ClassName.MENULEFT) || $$$1(this._menu).hasClass(ClassName.MENURIGHT)) { |
|
3974
|
|
|
element = parent; |
|
3975
|
|
|
} |
|
3976
|
|
|
} // If boundary is not `scrollParent`, then set position to `static` |
|
3977
|
|
|
// to allow the menu to "escape" the scroll parent's boundaries |
|
3978
|
|
|
// https://github.com/twbs/bootstrap/issues/24251 |
|
3979
|
|
|
|
|
3980
|
|
|
|
|
3981
|
|
|
if (this._config.boundary !== 'scrollParent') { |
|
3982
|
|
|
$$$1(parent).addClass(ClassName.POSITION_STATIC); |
|
3983
|
|
|
} |
|
3984
|
|
|
|
|
3985
|
|
|
this._popper = new Popper(element, this._menu, this._getPopperConfig()); |
|
3986
|
|
|
} // If this is a touch-enabled device we add extra |
|
3987
|
|
|
// empty mouseover listeners to the body's immediate children; |
|
3988
|
|
|
// only needed because of broken event delegation on iOS |
|
3989
|
|
|
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html |
|
3990
|
|
|
|
|
3991
|
|
|
|
|
3992
|
|
|
if ('ontouchstart' in document.documentElement && $$$1(parent).closest(Selector.NAVBAR_NAV).length === 0) { |
|
3993
|
|
|
$$$1('body').children().on('mouseover', null, $$$1.noop); |
|
3994
|
|
|
} |
|
3995
|
|
|
|
|
3996
|
|
|
this._element.focus(); |
|
3997
|
|
|
|
|
3998
|
|
|
this._element.setAttribute('aria-expanded', true); |
|
3999
|
|
|
|
|
4000
|
|
|
$$$1(this._menu).toggleClass(ClassName.SHOW); |
|
4001
|
|
|
$$$1(parent).toggleClass(ClassName.SHOW).trigger($$$1.Event(Event.SHOWN, relatedTarget)); |
|
4002
|
|
|
}; |
|
4003
|
|
|
|
|
4004
|
|
|
_proto.dispose = function dispose() { |
|
4005
|
|
|
$$$1.removeData(this._element, DATA_KEY); |
|
4006
|
|
|
$$$1(this._element).off(EVENT_KEY); |
|
4007
|
|
|
this._element = null; |
|
4008
|
|
|
this._menu = null; |
|
4009
|
|
|
|
|
4010
|
|
|
if (this._popper !== null) { |
|
4011
|
|
|
this._popper.destroy(); |
|
4012
|
|
|
|
|
4013
|
|
|
this._popper = null; |
|
4014
|
|
|
} |
|
4015
|
|
|
}; |
|
4016
|
|
|
|
|
4017
|
|
|
_proto.update = function update() { |
|
4018
|
|
|
this._inNavbar = this._detectNavbar(); |
|
4019
|
|
|
|
|
4020
|
|
|
if (this._popper !== null) { |
|
4021
|
|
|
this._popper.scheduleUpdate(); |
|
4022
|
|
|
} |
|
4023
|
|
|
}; // Private |
|
4024
|
|
|
|
|
4025
|
|
|
|
|
4026
|
|
|
_proto._addEventListeners = function _addEventListeners() { |
|
4027
|
|
|
var _this = this; |
|
4028
|
|
|
|
|
4029
|
|
|
$$$1(this._element).on(Event.CLICK, function (event) { |
|
4030
|
|
|
event.preventDefault(); |
|
4031
|
|
|
event.stopPropagation(); |
|
4032
|
|
|
|
|
4033
|
|
|
_this.toggle(); |
|
4034
|
|
|
}); |
|
4035
|
|
|
}; |
|
4036
|
|
|
|
|
4037
|
|
|
_proto._getConfig = function _getConfig(config) { |
|
4038
|
|
|
config = _extends({}, this.constructor.Default, $$$1(this._element).data(), config); |
|
4039
|
|
|
Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); |
|
4040
|
|
|
return config; |
|
4041
|
|
|
}; |
|
4042
|
|
|
|
|
4043
|
|
|
_proto._getMenuElement = function _getMenuElement() { |
|
4044
|
|
|
if (!this._menu) { |
|
4045
|
|
|
var parent = Dropdown._getParentFromElement(this._element); |
|
4046
|
|
|
|
|
4047
|
|
|
this._menu = $$$1(parent).find(Selector.MENU)[0]; |
|
4048
|
|
|
} |
|
4049
|
|
|
|
|
4050
|
|
|
return this._menu; |
|
4051
|
|
|
}; |
|
4052
|
|
|
|
|
4053
|
|
|
_proto._getPlacement = function _getPlacement() { |
|
4054
|
|
|
var $parentDropdown = $$$1(this._element).parent(); |
|
4055
|
|
|
var placement = AttachmentMap.BOTTOM; // Handle dropup |
|
4056
|
|
|
|
|
4057
|
|
|
if ($parentDropdown.hasClass(ClassName.DROPUP)) { |
|
4058
|
|
|
placement = AttachmentMap.TOP; |
|
4059
|
|
|
|
|
4060
|
|
|
if ($$$1(this._menu).hasClass(ClassName.MENURIGHT)) { |
|
4061
|
|
|
placement = AttachmentMap.TOPEND; |
|
4062
|
|
|
} |
|
4063
|
|
|
} else if ($parentDropdown.hasClass(ClassName.DROPRIGHT)) { |
|
4064
|
|
|
placement = AttachmentMap.RIGHT; |
|
4065
|
|
|
} else if ($parentDropdown.hasClass(ClassName.DROPLEFT)) { |
|
4066
|
|
|
placement = AttachmentMap.LEFT; |
|
4067
|
|
|
} else if ($$$1(this._menu).hasClass(ClassName.MENURIGHT)) { |
|
4068
|
|
|
placement = AttachmentMap.BOTTOMEND; |
|
4069
|
|
|
} |
|
4070
|
|
|
|
|
4071
|
|
|
return placement; |
|
4072
|
|
|
}; |
|
4073
|
|
|
|
|
4074
|
|
|
_proto._detectNavbar = function _detectNavbar() { |
|
4075
|
|
|
return $$$1(this._element).closest('.navbar').length > 0; |
|
4076
|
|
|
}; |
|
4077
|
|
|
|
|
4078
|
|
|
_proto._getPopperConfig = function _getPopperConfig() { |
|
4079
|
|
|
var _this2 = this; |
|
4080
|
|
|
|
|
4081
|
|
|
var offsetConf = {}; |
|
4082
|
|
|
|
|
4083
|
|
|
if (typeof this._config.offset === 'function') { |
|
4084
|
|
|
offsetConf.fn = function (data) { |
|
4085
|
|
|
data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets) || {}); |
|
4086
|
|
|
return data; |
|
4087
|
|
|
}; |
|
4088
|
|
|
} else { |
|
4089
|
|
|
offsetConf.offset = this._config.offset; |
|
4090
|
|
|
} |
|
4091
|
|
|
|
|
4092
|
|
|
var popperConfig = { |
|
4093
|
|
|
placement: this._getPlacement(), |
|
4094
|
|
|
modifiers: { |
|
4095
|
|
|
offset: offsetConf, |
|
4096
|
|
|
flip: { |
|
4097
|
|
|
enabled: this._config.flip |
|
4098
|
|
|
}, |
|
4099
|
|
|
preventOverflow: { |
|
4100
|
|
|
boundariesElement: this._config.boundary |
|
4101
|
|
|
} |
|
4102
|
|
|
} |
|
4103
|
|
|
}; |
|
4104
|
|
|
return popperConfig; |
|
4105
|
|
|
}; // Static |
|
4106
|
|
|
|
|
4107
|
|
|
|
|
4108
|
|
|
Dropdown._jQueryInterface = function _jQueryInterface(config) { |
|
4109
|
|
|
return this.each(function () { |
|
4110
|
|
|
var data = $$$1(this).data(DATA_KEY); |
|
4111
|
|
|
|
|
4112
|
|
|
var _config = typeof config === 'object' ? config : null; |
|
4113
|
|
|
|
|
4114
|
|
|
if (!data) { |
|
4115
|
|
|
data = new Dropdown(this, _config); |
|
4116
|
|
|
$$$1(this).data(DATA_KEY, data); |
|
4117
|
|
|
} |
|
4118
|
|
|
|
|
4119
|
|
|
if (typeof config === 'string') { |
|
4120
|
|
|
if (typeof data[config] === 'undefined') { |
|
4121
|
|
|
throw new TypeError("No method named \"" + config + "\""); |
|
4122
|
|
|
} |
|
4123
|
|
|
|
|
4124
|
|
|
data[config](); |
|
4125
|
|
|
} |
|
4126
|
|
|
}); |
|
4127
|
|
|
}; |
|
4128
|
|
|
|
|
4129
|
|
|
Dropdown._clearMenus = function _clearMenus(event) { |
|
4130
|
|
|
if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { |
|
4131
|
|
|
return; |
|
4132
|
|
|
} |
|
4133
|
|
|
|
|
4134
|
|
|
var toggles = $$$1.makeArray($$$1(Selector.DATA_TOGGLE)); |
|
4135
|
|
|
|
|
4136
|
|
|
for (var i = 0; i < toggles.length; i++) { |
|
4137
|
|
|
var parent = Dropdown._getParentFromElement(toggles[i]); |
|
4138
|
|
|
|
|
4139
|
|
|
var context = $$$1(toggles[i]).data(DATA_KEY); |
|
4140
|
|
|
var relatedTarget = { |
|
4141
|
|
|
relatedTarget: toggles[i] |
|
4142
|
|
|
}; |
|
4143
|
|
|
|
|
4144
|
|
|
if (!context) { |
|
4145
|
|
|
continue; |
|
4146
|
|
|
} |
|
4147
|
|
|
|
|
4148
|
|
|
var dropdownMenu = context._menu; |
|
4149
|
|
|
|
|
4150
|
|
|
if (!$$$1(parent).hasClass(ClassName.SHOW)) { |
|
4151
|
|
|
continue; |
|
4152
|
|
|
} |
|
4153
|
|
|
|
|
4154
|
|
|
if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $$$1.contains(parent, event.target)) { |
|
4155
|
|
|
continue; |
|
4156
|
|
|
} |
|
4157
|
|
|
|
|
4158
|
|
|
var hideEvent = $$$1.Event(Event.HIDE, relatedTarget); |
|
4159
|
|
|
$$$1(parent).trigger(hideEvent); |
|
4160
|
|
|
|
|
4161
|
|
|
if (hideEvent.isDefaultPrevented()) { |
|
4162
|
|
|
continue; |
|
4163
|
|
|
} // If this is a touch-enabled device we remove the extra |
|
4164
|
|
|
// empty mouseover listeners we added for iOS support |
|
4165
|
|
|
|
|
4166
|
|
|
|
|
4167
|
|
|
if ('ontouchstart' in document.documentElement) { |
|
4168
|
|
|
$$$1('body').children().off('mouseover', null, $$$1.noop); |
|
4169
|
|
|
} |
|
4170
|
|
|
|
|
4171
|
|
|
toggles[i].setAttribute('aria-expanded', 'false'); |
|
4172
|
|
|
$$$1(dropdownMenu).removeClass(ClassName.SHOW); |
|
4173
|
|
|
$$$1(parent).removeClass(ClassName.SHOW).trigger($$$1.Event(Event.HIDDEN, relatedTarget)); |
|
4174
|
|
|
} |
|
4175
|
|
|
}; |
|
4176
|
|
|
|
|
4177
|
|
|
Dropdown._getParentFromElement = function _getParentFromElement(element) { |
|
4178
|
|
|
var parent; |
|
4179
|
|
|
var selector = Util.getSelectorFromElement(element); |
|
4180
|
|
|
|
|
4181
|
|
|
if (selector) { |
|
4182
|
|
|
parent = $$$1(selector)[0]; |
|
4183
|
|
|
} |
|
4184
|
|
|
|
|
4185
|
|
|
return parent || element.parentNode; |
|
4186
|
|
|
}; // eslint-disable-next-line complexity |
|
4187
|
|
|
|
|
4188
|
|
|
|
|
4189
|
|
|
Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { |
|
4190
|
|
|
// If not input/textarea: |
|
4191
|
|
|
// - And not a key in REGEXP_KEYDOWN => not a dropdown command |
|
4192
|
|
|
// If input/textarea: |
|
4193
|
|
|
// - If space key => not a dropdown command |
|
4194
|
|
|
// - If key is other than escape |
|
4195
|
|
|
// - If key is not up or down => not a dropdown command |
|
4196
|
|
|
// - If trigger inside the menu => not a dropdown command |
|
4197
|
|
|
if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $$$1(event.target).closest(Selector.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { |
|
4198
|
|
|
return; |
|
4199
|
|
|
} |
|
4200
|
|
|
|
|
4201
|
|
|
event.preventDefault(); |
|
4202
|
|
|
event.stopPropagation(); |
|
4203
|
|
|
|
|
4204
|
|
|
if (this.disabled || $$$1(this).hasClass(ClassName.DISABLED)) { |
|
4205
|
|
|
return; |
|
4206
|
|
|
} |
|
4207
|
|
|
|
|
4208
|
|
|
var parent = Dropdown._getParentFromElement(this); |
|
4209
|
|
|
|
|
4210
|
|
|
var isActive = $$$1(parent).hasClass(ClassName.SHOW); |
|
4211
|
|
|
|
|
4212
|
|
|
if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { |
|
4213
|
|
|
if (event.which === ESCAPE_KEYCODE) { |
|
4214
|
|
|
var toggle = $$$1(parent).find(Selector.DATA_TOGGLE)[0]; |
|
4215
|
|
|
$$$1(toggle).trigger('focus'); |
|
4216
|
|
|
} |
|
4217
|
|
|
|
|
4218
|
|
|
$$$1(this).trigger('click'); |
|
4219
|
|
|
return; |
|
4220
|
|
|
} |
|
4221
|
|
|
|
|
4222
|
|
|
var items = $$$1(parent).find(Selector.VISIBLE_ITEMS).get(); |
|
4223
|
|
|
|
|
4224
|
|
|
if (items.length === 0) { |
|
4225
|
|
|
return; |
|
4226
|
|
|
} |
|
4227
|
|
|
|
|
4228
|
|
|
var index = items.indexOf(event.target); |
|
4229
|
|
|
|
|
4230
|
|
|
if (event.which === ARROW_UP_KEYCODE && index > 0) { |
|
4231
|
|
|
// Up |
|
4232
|
|
|
index--; |
|
4233
|
|
|
} |
|
4234
|
|
|
|
|
4235
|
|
|
if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { |
|
4236
|
|
|
// Down |
|
4237
|
|
|
index++; |
|
4238
|
|
|
} |
|
4239
|
|
|
|
|
4240
|
|
|
if (index < 0) { |
|
4241
|
|
|
index = 0; |
|
4242
|
|
|
} |
|
4243
|
|
|
|
|
4244
|
|
|
items[index].focus(); |
|
4245
|
|
|
}; |
|
4246
|
|
|
|
|
4247
|
|
|
_createClass(Dropdown, null, [{ |
|
4248
|
|
|
key: "VERSION", |
|
4249
|
|
|
get: function get() { |
|
4250
|
|
|
return VERSION; |
|
4251
|
|
|
} |
|
4252
|
|
|
}, { |
|
4253
|
|
|
key: "Default", |
|
4254
|
|
|
get: function get() { |
|
4255
|
|
|
return Default; |
|
4256
|
|
|
} |
|
4257
|
|
|
}, { |
|
4258
|
|
|
key: "DefaultType", |
|
4259
|
|
|
get: function get() { |
|
4260
|
|
|
return DefaultType; |
|
4261
|
|
|
} |
|
4262
|
|
|
}]); |
|
4263
|
|
|
return Dropdown; |
|
4264
|
|
|
}(); |
|
4265
|
|
|
/** |
|
4266
|
|
|
* ------------------------------------------------------------------------ |
|
4267
|
|
|
* Data Api implementation |
|
4268
|
|
|
* ------------------------------------------------------------------------ |
|
4269
|
|
|
*/ |
|
4270
|
|
|
|
|
4271
|
|
|
|
|
4272
|
|
|
$$$1(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API + " " + Event.KEYUP_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { |
|
4273
|
|
|
event.preventDefault(); |
|
4274
|
|
|
event.stopPropagation(); |
|
4275
|
|
|
|
|
4276
|
|
|
Dropdown._jQueryInterface.call($$$1(this), 'toggle'); |
|
4277
|
|
|
}).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) { |
|
4278
|
|
|
e.stopPropagation(); |
|
4279
|
|
|
}); |
|
4280
|
|
|
/** |
|
4281
|
|
|
* ------------------------------------------------------------------------ |
|
4282
|
|
|
* jQuery |
|
4283
|
|
|
* ------------------------------------------------------------------------ |
|
4284
|
|
|
*/ |
|
4285
|
|
|
|
|
4286
|
|
|
$$$1.fn[NAME] = Dropdown._jQueryInterface; |
|
4287
|
|
|
$$$1.fn[NAME].Constructor = Dropdown; |
|
4288
|
|
|
|
|
4289
|
|
|
$$$1.fn[NAME].noConflict = function () { |
|
4290
|
|
|
$$$1.fn[NAME] = JQUERY_NO_CONFLICT; |
|
4291
|
|
|
return Dropdown._jQueryInterface; |
|
4292
|
|
|
}; |
|
4293
|
|
|
|
|
4294
|
|
|
return Dropdown; |
|
4295
|
|
|
}($, Popper); |
|
4296
|
|
|
|
|
4297
|
|
|
/** |
|
4298
|
|
|
* -------------------------------------------------------------------------- |
|
4299
|
|
|
* Bootstrap (v4.0.0): modal.js |
|
4300
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
4301
|
|
|
* -------------------------------------------------------------------------- |
|
4302
|
|
|
*/ |
|
4303
|
|
|
|
|
4304
|
|
|
var Modal = function ($$$1) { |
|
4305
|
|
|
/** |
|
4306
|
|
|
* ------------------------------------------------------------------------ |
|
4307
|
|
|
* Constants |
|
4308
|
|
|
* ------------------------------------------------------------------------ |
|
4309
|
|
|
*/ |
|
4310
|
|
|
var NAME = 'modal'; |
|
4311
|
|
|
var VERSION = '4.0.0'; |
|
4312
|
|
|
var DATA_KEY = 'bs.modal'; |
|
4313
|
|
|
var EVENT_KEY = "." + DATA_KEY; |
|
4314
|
|
|
var DATA_API_KEY = '.data-api'; |
|
4315
|
|
|
var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; |
|
4316
|
|
|
var TRANSITION_DURATION = 300; |
|
4317
|
|
|
var BACKDROP_TRANSITION_DURATION = 150; |
|
4318
|
|
|
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key |
|
4319
|
|
|
|
|
4320
|
|
|
var Default = { |
|
4321
|
|
|
backdrop: true, |
|
4322
|
|
|
keyboard: true, |
|
4323
|
|
|
focus: true, |
|
4324
|
|
|
show: true |
|
4325
|
|
|
}; |
|
4326
|
|
|
var DefaultType = { |
|
4327
|
|
|
backdrop: '(boolean|string)', |
|
4328
|
|
|
keyboard: 'boolean', |
|
4329
|
|
|
focus: 'boolean', |
|
4330
|
|
|
show: 'boolean' |
|
4331
|
|
|
}; |
|
4332
|
|
|
var Event = { |
|
4333
|
|
|
HIDE: "hide" + EVENT_KEY, |
|
4334
|
|
|
HIDDEN: "hidden" + EVENT_KEY, |
|
4335
|
|
|
SHOW: "show" + EVENT_KEY, |
|
4336
|
|
|
SHOWN: "shown" + EVENT_KEY, |
|
4337
|
|
|
FOCUSIN: "focusin" + EVENT_KEY, |
|
4338
|
|
|
RESIZE: "resize" + EVENT_KEY, |
|
4339
|
|
|
CLICK_DISMISS: "click.dismiss" + EVENT_KEY, |
|
4340
|
|
|
KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY, |
|
4341
|
|
|
MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY, |
|
4342
|
|
|
MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY, |
|
4343
|
|
|
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY |
|
4344
|
|
|
}; |
|
4345
|
|
|
var ClassName = { |
|
4346
|
|
|
SCROLLBAR_MEASURER: 'modal-scrollbar-measure', |
|
4347
|
|
|
BACKDROP: 'modal-backdrop', |
|
4348
|
|
|
OPEN: 'modal-open', |
|
4349
|
|
|
FADE: 'fade', |
|
4350
|
|
|
SHOW: 'show' |
|
4351
|
|
|
}; |
|
4352
|
|
|
var Selector = { |
|
4353
|
|
|
DIALOG: '.modal-dialog', |
|
4354
|
|
|
DATA_TOGGLE: '[data-toggle="modal"]', |
|
4355
|
|
|
DATA_DISMISS: '[data-dismiss="modal"]', |
|
4356
|
|
|
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', |
|
4357
|
|
|
STICKY_CONTENT: '.sticky-top', |
|
4358
|
|
|
NAVBAR_TOGGLER: '.navbar-toggler' |
|
4359
|
|
|
/** |
|
4360
|
|
|
* ------------------------------------------------------------------------ |
|
4361
|
|
|
* Class Definition |
|
4362
|
|
|
* ------------------------------------------------------------------------ |
|
4363
|
|
|
*/ |
|
4364
|
|
|
|
|
4365
|
|
|
}; |
|
4366
|
|
|
|
|
4367
|
|
|
var Modal = |
|
4368
|
|
|
/*#__PURE__*/ |
|
4369
|
|
|
function () { |
|
4370
|
|
|
function Modal(element, config) { |
|
4371
|
|
|
this._config = this._getConfig(config); |
|
4372
|
|
|
this._element = element; |
|
4373
|
|
|
this._dialog = $$$1(element).find(Selector.DIALOG)[0]; |
|
4374
|
|
|
this._backdrop = null; |
|
4375
|
|
|
this._isShown = false; |
|
4376
|
|
|
this._isBodyOverflowing = false; |
|
4377
|
|
|
this._ignoreBackdropClick = false; |
|
4378
|
|
|
this._originalBodyPadding = 0; |
|
4379
|
|
|
this._scrollbarWidth = 0; |
|
4380
|
|
|
} // Getters |
|
4381
|
|
|
|
|
4382
|
|
|
|
|
4383
|
|
|
var _proto = Modal.prototype; |
|
4384
|
|
|
|
|
4385
|
|
|
// Public |
|
4386
|
|
|
_proto.toggle = function toggle(relatedTarget) { |
|
4387
|
|
|
return this._isShown ? this.hide() : this.show(relatedTarget); |
|
4388
|
|
|
}; |
|
4389
|
|
|
|
|
4390
|
|
|
_proto.show = function show(relatedTarget) { |
|
4391
|
|
|
var _this = this; |
|
4392
|
|
|
|
|
4393
|
|
|
if (this._isTransitioning || this._isShown) { |
|
4394
|
|
|
return; |
|
4395
|
|
|
} |
|
4396
|
|
|
|
|
4397
|
|
|
if (Util.supportsTransitionEnd() && $$$1(this._element).hasClass(ClassName.FADE)) { |
|
4398
|
|
|
this._isTransitioning = true; |
|
4399
|
|
|
} |
|
4400
|
|
|
|
|
4401
|
|
|
var showEvent = $$$1.Event(Event.SHOW, { |
|
4402
|
|
|
relatedTarget: relatedTarget |
|
4403
|
|
|
}); |
|
4404
|
|
|
$$$1(this._element).trigger(showEvent); |
|
4405
|
|
|
|
|
4406
|
|
|
if (this._isShown || showEvent.isDefaultPrevented()) { |
|
4407
|
|
|
return; |
|
4408
|
|
|
} |
|
4409
|
|
|
|
|
4410
|
|
|
this._isShown = true; |
|
4411
|
|
|
|
|
4412
|
|
|
this._checkScrollbar(); |
|
4413
|
|
|
|
|
4414
|
|
|
this._setScrollbar(); |
|
4415
|
|
|
|
|
4416
|
|
|
this._adjustDialog(); |
|
4417
|
|
|
|
|
4418
|
|
|
$$$1(document.body).addClass(ClassName.OPEN); |
|
4419
|
|
|
|
|
4420
|
|
|
this._setEscapeEvent(); |
|
4421
|
|
|
|
|
4422
|
|
|
this._setResizeEvent(); |
|
4423
|
|
|
|
|
4424
|
|
|
$$$1(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) { |
|
4425
|
|
|
return _this.hide(event); |
|
4426
|
|
|
}); |
|
4427
|
|
|
$$$1(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () { |
|
4428
|
|
|
$$$1(_this._element).one(Event.MOUSEUP_DISMISS, function (event) { |
|
4429
|
|
|
if ($$$1(event.target).is(_this._element)) { |
|
4430
|
|
|
_this._ignoreBackdropClick = true; |
|
4431
|
|
|
} |
|
4432
|
|
|
}); |
|
4433
|
|
|
}); |
|
4434
|
|
|
|
|
4435
|
|
|
this._showBackdrop(function () { |
|
4436
|
|
|
return _this._showElement(relatedTarget); |
|
4437
|
|
|
}); |
|
4438
|
|
|
}; |
|
4439
|
|
|
|
|
4440
|
|
|
_proto.hide = function hide(event) { |
|
4441
|
|
|
var _this2 = this; |
|
4442
|
|
|
|
|
4443
|
|
|
if (event) { |
|
4444
|
|
|
event.preventDefault(); |
|
4445
|
|
|
} |
|
4446
|
|
|
|
|
4447
|
|
|
if (this._isTransitioning || !this._isShown) { |
|
4448
|
|
|
return; |
|
4449
|
|
|
} |
|
4450
|
|
|
|
|
4451
|
|
|
var hideEvent = $$$1.Event(Event.HIDE); |
|
4452
|
|
|
$$$1(this._element).trigger(hideEvent); |
|
4453
|
|
|
|
|
4454
|
|
|
if (!this._isShown || hideEvent.isDefaultPrevented()) { |
|
4455
|
|
|
return; |
|
4456
|
|
|
} |
|
4457
|
|
|
|
|
4458
|
|
|
this._isShown = false; |
|
4459
|
|
|
var transition = Util.supportsTransitionEnd() && $$$1(this._element).hasClass(ClassName.FADE); |
|
4460
|
|
|
|
|
4461
|
|
|
if (transition) { |
|
4462
|
|
|
this._isTransitioning = true; |
|
4463
|
|
|
} |
|
4464
|
|
|
|
|
4465
|
|
|
this._setEscapeEvent(); |
|
4466
|
|
|
|
|
4467
|
|
|
this._setResizeEvent(); |
|
4468
|
|
|
|
|
4469
|
|
|
$$$1(document).off(Event.FOCUSIN); |
|
4470
|
|
|
$$$1(this._element).removeClass(ClassName.SHOW); |
|
4471
|
|
|
$$$1(this._element).off(Event.CLICK_DISMISS); |
|
4472
|
|
|
$$$1(this._dialog).off(Event.MOUSEDOWN_DISMISS); |
|
4473
|
|
|
|
|
4474
|
|
|
if (transition) { |
|
4475
|
|
|
$$$1(this._element).one(Util.TRANSITION_END, function (event) { |
|
4476
|
|
|
return _this2._hideModal(event); |
|
4477
|
|
|
}).emulateTransitionEnd(TRANSITION_DURATION); |
|
4478
|
|
|
} else { |
|
4479
|
|
|
this._hideModal(); |
|
4480
|
|
|
} |
|
4481
|
|
|
}; |
|
4482
|
|
|
|
|
4483
|
|
|
_proto.dispose = function dispose() { |
|
4484
|
|
|
$$$1.removeData(this._element, DATA_KEY); |
|
4485
|
|
|
$$$1(window, document, this._element, this._backdrop).off(EVENT_KEY); |
|
4486
|
|
|
this._config = null; |
|
4487
|
|
|
this._element = null; |
|
4488
|
|
|
this._dialog = null; |
|
4489
|
|
|
this._backdrop = null; |
|
4490
|
|
|
this._isShown = null; |
|
4491
|
|
|
this._isBodyOverflowing = null; |
|
4492
|
|
|
this._ignoreBackdropClick = null; |
|
4493
|
|
|
this._scrollbarWidth = null; |
|
4494
|
|
|
}; |
|
4495
|
|
|
|
|
4496
|
|
|
_proto.handleUpdate = function handleUpdate() { |
|
4497
|
|
|
this._adjustDialog(); |
|
4498
|
|
|
}; // Private |
|
4499
|
|
|
|
|
4500
|
|
|
|
|
4501
|
|
|
_proto._getConfig = function _getConfig(config) { |
|
4502
|
|
|
config = _extends({}, Default, config); |
|
4503
|
|
|
Util.typeCheckConfig(NAME, config, DefaultType); |
|
4504
|
|
|
return config; |
|
4505
|
|
|
}; |
|
4506
|
|
|
|
|
4507
|
|
|
_proto._showElement = function _showElement(relatedTarget) { |
|
4508
|
|
|
var _this3 = this; |
|
4509
|
|
|
|
|
4510
|
|
|
var transition = Util.supportsTransitionEnd() && $$$1(this._element).hasClass(ClassName.FADE); |
|
4511
|
|
|
|
|
4512
|
|
|
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { |
|
|
|
|
|
|
4513
|
|
|
// Don't move modal's DOM position |
|
4514
|
|
|
document.body.appendChild(this._element); |
|
4515
|
|
|
} |
|
4516
|
|
|
|
|
4517
|
|
|
this._element.style.display = 'block'; |
|
4518
|
|
|
|
|
4519
|
|
|
this._element.removeAttribute('aria-hidden'); |
|
4520
|
|
|
|
|
4521
|
|
|
this._element.scrollTop = 0; |
|
4522
|
|
|
|
|
4523
|
|
|
if (transition) { |
|
4524
|
|
|
Util.reflow(this._element); |
|
4525
|
|
|
} |
|
4526
|
|
|
|
|
4527
|
|
|
$$$1(this._element).addClass(ClassName.SHOW); |
|
4528
|
|
|
|
|
4529
|
|
|
if (this._config.focus) { |
|
4530
|
|
|
this._enforceFocus(); |
|
4531
|
|
|
} |
|
4532
|
|
|
|
|
4533
|
|
|
var shownEvent = $$$1.Event(Event.SHOWN, { |
|
4534
|
|
|
relatedTarget: relatedTarget |
|
4535
|
|
|
}); |
|
4536
|
|
|
|
|
4537
|
|
|
var transitionComplete = function transitionComplete() { |
|
4538
|
|
|
if (_this3._config.focus) { |
|
4539
|
|
|
_this3._element.focus(); |
|
4540
|
|
|
} |
|
4541
|
|
|
|
|
4542
|
|
|
_this3._isTransitioning = false; |
|
4543
|
|
|
$$$1(_this3._element).trigger(shownEvent); |
|
4544
|
|
|
}; |
|
4545
|
|
|
|
|
4546
|
|
|
if (transition) { |
|
4547
|
|
|
$$$1(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION); |
|
4548
|
|
|
} else { |
|
4549
|
|
|
transitionComplete(); |
|
4550
|
|
|
} |
|
4551
|
|
|
}; |
|
4552
|
|
|
|
|
4553
|
|
|
_proto._enforceFocus = function _enforceFocus() { |
|
4554
|
|
|
var _this4 = this; |
|
4555
|
|
|
|
|
4556
|
|
|
$$$1(document).off(Event.FOCUSIN) // Guard against infinite focus loop |
|
4557
|
|
|
.on(Event.FOCUSIN, function (event) { |
|
4558
|
|
|
if (document !== event.target && _this4._element !== event.target && $$$1(_this4._element).has(event.target).length === 0) { |
|
4559
|
|
|
_this4._element.focus(); |
|
4560
|
|
|
} |
|
4561
|
|
|
}); |
|
4562
|
|
|
}; |
|
4563
|
|
|
|
|
4564
|
|
|
_proto._setEscapeEvent = function _setEscapeEvent() { |
|
4565
|
|
|
var _this5 = this; |
|
4566
|
|
|
|
|
4567
|
|
|
if (this._isShown && this._config.keyboard) { |
|
4568
|
|
|
$$$1(this._element).on(Event.KEYDOWN_DISMISS, function (event) { |
|
4569
|
|
|
if (event.which === ESCAPE_KEYCODE) { |
|
4570
|
|
|
event.preventDefault(); |
|
4571
|
|
|
|
|
4572
|
|
|
_this5.hide(); |
|
4573
|
|
|
} |
|
4574
|
|
|
}); |
|
4575
|
|
|
} else if (!this._isShown) { |
|
4576
|
|
|
$$$1(this._element).off(Event.KEYDOWN_DISMISS); |
|
4577
|
|
|
} |
|
4578
|
|
|
}; |
|
4579
|
|
|
|
|
4580
|
|
|
_proto._setResizeEvent = function _setResizeEvent() { |
|
4581
|
|
|
var _this6 = this; |
|
4582
|
|
|
|
|
4583
|
|
|
if (this._isShown) { |
|
4584
|
|
|
$$$1(window).on(Event.RESIZE, function (event) { |
|
4585
|
|
|
return _this6.handleUpdate(event); |
|
4586
|
|
|
}); |
|
4587
|
|
|
} else { |
|
4588
|
|
|
$$$1(window).off(Event.RESIZE); |
|
4589
|
|
|
} |
|
4590
|
|
|
}; |
|
4591
|
|
|
|
|
4592
|
|
|
_proto._hideModal = function _hideModal() { |
|
4593
|
|
|
var _this7 = this; |
|
4594
|
|
|
|
|
4595
|
|
|
this._element.style.display = 'none'; |
|
4596
|
|
|
|
|
4597
|
|
|
this._element.setAttribute('aria-hidden', true); |
|
4598
|
|
|
|
|
4599
|
|
|
this._isTransitioning = false; |
|
4600
|
|
|
|
|
4601
|
|
|
this._showBackdrop(function () { |
|
4602
|
|
|
$$$1(document.body).removeClass(ClassName.OPEN); |
|
4603
|
|
|
|
|
4604
|
|
|
_this7._resetAdjustments(); |
|
4605
|
|
|
|
|
4606
|
|
|
_this7._resetScrollbar(); |
|
4607
|
|
|
|
|
4608
|
|
|
$$$1(_this7._element).trigger(Event.HIDDEN); |
|
4609
|
|
|
}); |
|
4610
|
|
|
}; |
|
4611
|
|
|
|
|
4612
|
|
|
_proto._removeBackdrop = function _removeBackdrop() { |
|
4613
|
|
|
if (this._backdrop) { |
|
4614
|
|
|
$$$1(this._backdrop).remove(); |
|
4615
|
|
|
this._backdrop = null; |
|
4616
|
|
|
} |
|
4617
|
|
|
}; |
|
4618
|
|
|
|
|
4619
|
|
|
_proto._showBackdrop = function _showBackdrop(callback) { |
|
4620
|
|
|
var _this8 = this; |
|
4621
|
|
|
|
|
4622
|
|
|
var animate = $$$1(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : ''; |
|
4623
|
|
|
|
|
4624
|
|
|
if (this._isShown && this._config.backdrop) { |
|
4625
|
|
|
var doAnimate = Util.supportsTransitionEnd() && animate; |
|
4626
|
|
|
this._backdrop = document.createElement('div'); |
|
4627
|
|
|
this._backdrop.className = ClassName.BACKDROP; |
|
4628
|
|
|
|
|
4629
|
|
|
if (animate) { |
|
4630
|
|
|
$$$1(this._backdrop).addClass(animate); |
|
4631
|
|
|
} |
|
4632
|
|
|
|
|
4633
|
|
|
$$$1(this._backdrop).appendTo(document.body); |
|
4634
|
|
|
$$$1(this._element).on(Event.CLICK_DISMISS, function (event) { |
|
4635
|
|
|
if (_this8._ignoreBackdropClick) { |
|
4636
|
|
|
_this8._ignoreBackdropClick = false; |
|
4637
|
|
|
return; |
|
4638
|
|
|
} |
|
4639
|
|
|
|
|
4640
|
|
|
if (event.target !== event.currentTarget) { |
|
4641
|
|
|
return; |
|
4642
|
|
|
} |
|
4643
|
|
|
|
|
4644
|
|
|
if (_this8._config.backdrop === 'static') { |
|
4645
|
|
|
_this8._element.focus(); |
|
4646
|
|
|
} else { |
|
4647
|
|
|
_this8.hide(); |
|
4648
|
|
|
} |
|
4649
|
|
|
}); |
|
4650
|
|
|
|
|
4651
|
|
|
if (doAnimate) { |
|
4652
|
|
|
Util.reflow(this._backdrop); |
|
4653
|
|
|
} |
|
4654
|
|
|
|
|
4655
|
|
|
$$$1(this._backdrop).addClass(ClassName.SHOW); |
|
4656
|
|
|
|
|
4657
|
|
|
if (!callback) { |
|
4658
|
|
|
return; |
|
4659
|
|
|
} |
|
4660
|
|
|
|
|
4661
|
|
|
if (!doAnimate) { |
|
4662
|
|
|
callback(); |
|
4663
|
|
|
return; |
|
4664
|
|
|
} |
|
4665
|
|
|
|
|
4666
|
|
|
$$$1(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION); |
|
4667
|
|
|
} else if (!this._isShown && this._backdrop) { |
|
4668
|
|
|
$$$1(this._backdrop).removeClass(ClassName.SHOW); |
|
4669
|
|
|
|
|
4670
|
|
|
var callbackRemove = function callbackRemove() { |
|
4671
|
|
|
_this8._removeBackdrop(); |
|
4672
|
|
|
|
|
4673
|
|
|
if (callback) { |
|
4674
|
|
|
callback(); |
|
4675
|
|
|
} |
|
4676
|
|
|
}; |
|
4677
|
|
|
|
|
4678
|
|
|
if (Util.supportsTransitionEnd() && $$$1(this._element).hasClass(ClassName.FADE)) { |
|
4679
|
|
|
$$$1(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION); |
|
4680
|
|
|
} else { |
|
4681
|
|
|
callbackRemove(); |
|
4682
|
|
|
} |
|
4683
|
|
|
} else if (callback) { |
|
4684
|
|
|
callback(); |
|
4685
|
|
|
} |
|
4686
|
|
|
}; // ---------------------------------------------------------------------- |
|
4687
|
|
|
// the following methods are used to handle overflowing modals |
|
4688
|
|
|
// todo (fat): these should probably be refactored out of modal.js |
|
4689
|
|
|
// ---------------------------------------------------------------------- |
|
4690
|
|
|
|
|
4691
|
|
|
|
|
4692
|
|
|
_proto._adjustDialog = function _adjustDialog() { |
|
4693
|
|
|
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; |
|
4694
|
|
|
|
|
4695
|
|
|
if (!this._isBodyOverflowing && isModalOverflowing) { |
|
4696
|
|
|
this._element.style.paddingLeft = this._scrollbarWidth + "px"; |
|
4697
|
|
|
} |
|
4698
|
|
|
|
|
4699
|
|
|
if (this._isBodyOverflowing && !isModalOverflowing) { |
|
4700
|
|
|
this._element.style.paddingRight = this._scrollbarWidth + "px"; |
|
4701
|
|
|
} |
|
4702
|
|
|
}; |
|
4703
|
|
|
|
|
4704
|
|
|
_proto._resetAdjustments = function _resetAdjustments() { |
|
4705
|
|
|
this._element.style.paddingLeft = ''; |
|
4706
|
|
|
this._element.style.paddingRight = ''; |
|
4707
|
|
|
}; |
|
4708
|
|
|
|
|
4709
|
|
|
_proto._checkScrollbar = function _checkScrollbar() { |
|
4710
|
|
|
var rect = document.body.getBoundingClientRect(); |
|
4711
|
|
|
this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; |
|
4712
|
|
|
this._scrollbarWidth = this._getScrollbarWidth(); |
|
4713
|
|
|
}; |
|
4714
|
|
|
|
|
4715
|
|
|
_proto._setScrollbar = function _setScrollbar() { |
|
4716
|
|
|
var _this9 = this; |
|
4717
|
|
|
|
|
4718
|
|
|
if (this._isBodyOverflowing) { |
|
4719
|
|
|
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set |
|
4720
|
|
|
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set |
|
4721
|
|
|
// Adjust fixed content padding |
|
4722
|
|
|
$$$1(Selector.FIXED_CONTENT).each(function (index, element) { |
|
4723
|
|
|
var actualPadding = $$$1(element)[0].style.paddingRight; |
|
4724
|
|
|
var calculatedPadding = $$$1(element).css('padding-right'); |
|
4725
|
|
|
$$$1(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px"); |
|
4726
|
|
|
}); // Adjust sticky content margin |
|
4727
|
|
|
|
|
4728
|
|
|
$$$1(Selector.STICKY_CONTENT).each(function (index, element) { |
|
4729
|
|
|
var actualMargin = $$$1(element)[0].style.marginRight; |
|
4730
|
|
|
var calculatedMargin = $$$1(element).css('margin-right'); |
|
4731
|
|
|
$$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px"); |
|
4732
|
|
|
}); // Adjust navbar-toggler margin |
|
4733
|
|
|
|
|
4734
|
|
|
$$$1(Selector.NAVBAR_TOGGLER).each(function (index, element) { |
|
4735
|
|
|
var actualMargin = $$$1(element)[0].style.marginRight; |
|
4736
|
|
|
var calculatedMargin = $$$1(element).css('margin-right'); |
|
4737
|
|
|
$$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + "px"); |
|
4738
|
|
|
}); // Adjust body padding |
|
4739
|
|
|
|
|
4740
|
|
|
var actualPadding = document.body.style.paddingRight; |
|
4741
|
|
|
var calculatedPadding = $$$1('body').css('padding-right'); |
|
4742
|
|
|
$$$1('body').data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); |
|
4743
|
|
|
} |
|
4744
|
|
|
}; |
|
4745
|
|
|
|
|
4746
|
|
|
_proto._resetScrollbar = function _resetScrollbar() { |
|
4747
|
|
|
// Restore fixed content padding |
|
4748
|
|
|
$$$1(Selector.FIXED_CONTENT).each(function (index, element) { |
|
4749
|
|
|
var padding = $$$1(element).data('padding-right'); |
|
4750
|
|
|
|
|
4751
|
|
|
if (typeof padding !== 'undefined') { |
|
4752
|
|
|
$$$1(element).css('padding-right', padding).removeData('padding-right'); |
|
4753
|
|
|
} |
|
4754
|
|
|
}); // Restore sticky content and navbar-toggler margin |
|
4755
|
|
|
|
|
4756
|
|
|
$$$1(Selector.STICKY_CONTENT + ", " + Selector.NAVBAR_TOGGLER).each(function (index, element) { |
|
4757
|
|
|
var margin = $$$1(element).data('margin-right'); |
|
4758
|
|
|
|
|
4759
|
|
|
if (typeof margin !== 'undefined') { |
|
4760
|
|
|
$$$1(element).css('margin-right', margin).removeData('margin-right'); |
|
4761
|
|
|
} |
|
4762
|
|
|
}); // Restore body padding |
|
4763
|
|
|
|
|
4764
|
|
|
var padding = $$$1('body').data('padding-right'); |
|
4765
|
|
|
|
|
4766
|
|
|
if (typeof padding !== 'undefined') { |
|
4767
|
|
|
$$$1('body').css('padding-right', padding).removeData('padding-right'); |
|
4768
|
|
|
} |
|
4769
|
|
|
}; |
|
4770
|
|
|
|
|
4771
|
|
|
_proto._getScrollbarWidth = function _getScrollbarWidth() { |
|
4772
|
|
|
// thx d.walsh |
|
4773
|
|
|
var scrollDiv = document.createElement('div'); |
|
4774
|
|
|
scrollDiv.className = ClassName.SCROLLBAR_MEASURER; |
|
4775
|
|
|
document.body.appendChild(scrollDiv); |
|
4776
|
|
|
var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; |
|
4777
|
|
|
document.body.removeChild(scrollDiv); |
|
4778
|
|
|
return scrollbarWidth; |
|
4779
|
|
|
}; // Static |
|
4780
|
|
|
|
|
4781
|
|
|
|
|
4782
|
|
|
Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { |
|
4783
|
|
|
return this.each(function () { |
|
4784
|
|
|
var data = $$$1(this).data(DATA_KEY); |
|
4785
|
|
|
|
|
4786
|
|
|
var _config = _extends({}, Modal.Default, $$$1(this).data(), typeof config === 'object' && config); |
|
4787
|
|
|
|
|
4788
|
|
|
if (!data) { |
|
4789
|
|
|
data = new Modal(this, _config); |
|
4790
|
|
|
$$$1(this).data(DATA_KEY, data); |
|
4791
|
|
|
} |
|
4792
|
|
|
|
|
4793
|
|
|
if (typeof config === 'string') { |
|
4794
|
|
|
if (typeof data[config] === 'undefined') { |
|
4795
|
|
|
throw new TypeError("No method named \"" + config + "\""); |
|
4796
|
|
|
} |
|
4797
|
|
|
|
|
4798
|
|
|
data[config](relatedTarget); |
|
4799
|
|
|
} else if (_config.show) { |
|
4800
|
|
|
data.show(relatedTarget); |
|
4801
|
|
|
} |
|
4802
|
|
|
}); |
|
4803
|
|
|
}; |
|
4804
|
|
|
|
|
4805
|
|
|
_createClass(Modal, null, [{ |
|
4806
|
|
|
key: "VERSION", |
|
4807
|
|
|
get: function get() { |
|
4808
|
|
|
return VERSION; |
|
4809
|
|
|
} |
|
4810
|
|
|
}, { |
|
4811
|
|
|
key: "Default", |
|
4812
|
|
|
get: function get() { |
|
4813
|
|
|
return Default; |
|
4814
|
|
|
} |
|
4815
|
|
|
}]); |
|
4816
|
|
|
return Modal; |
|
4817
|
|
|
}(); |
|
4818
|
|
|
/** |
|
4819
|
|
|
* ------------------------------------------------------------------------ |
|
4820
|
|
|
* Data Api implementation |
|
4821
|
|
|
* ------------------------------------------------------------------------ |
|
4822
|
|
|
*/ |
|
4823
|
|
|
|
|
4824
|
|
|
|
|
4825
|
|
|
$$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { |
|
4826
|
|
|
var _this10 = this; |
|
4827
|
|
|
|
|
4828
|
|
|
var target; |
|
4829
|
|
|
var selector = Util.getSelectorFromElement(this); |
|
4830
|
|
|
|
|
4831
|
|
|
if (selector) { |
|
4832
|
|
|
target = $$$1(selector)[0]; |
|
4833
|
|
|
} |
|
4834
|
|
|
|
|
4835
|
|
|
var config = $$$1(target).data(DATA_KEY) ? 'toggle' : _extends({}, $$$1(target).data(), $$$1(this).data()); |
|
|
|
|
|
|
4836
|
|
|
|
|
4837
|
|
|
if (this.tagName === 'A' || this.tagName === 'AREA') { |
|
4838
|
|
|
event.preventDefault(); |
|
4839
|
|
|
} |
|
4840
|
|
|
|
|
4841
|
|
|
var $target = $$$1(target).one(Event.SHOW, function (showEvent) { |
|
4842
|
|
|
if (showEvent.isDefaultPrevented()) { |
|
4843
|
|
|
// Only register focus restorer if modal will actually get shown |
|
4844
|
|
|
return; |
|
4845
|
|
|
} |
|
4846
|
|
|
|
|
4847
|
|
|
$target.one(Event.HIDDEN, function () { |
|
4848
|
|
|
if ($$$1(_this10).is(':visible')) { |
|
4849
|
|
|
_this10.focus(); |
|
4850
|
|
|
} |
|
4851
|
|
|
}); |
|
4852
|
|
|
}); |
|
4853
|
|
|
|
|
4854
|
|
|
Modal._jQueryInterface.call($$$1(target), config, this); |
|
4855
|
|
|
}); |
|
4856
|
|
|
/** |
|
4857
|
|
|
* ------------------------------------------------------------------------ |
|
4858
|
|
|
* jQuery |
|
4859
|
|
|
* ------------------------------------------------------------------------ |
|
4860
|
|
|
*/ |
|
4861
|
|
|
|
|
4862
|
|
|
$$$1.fn[NAME] = Modal._jQueryInterface; |
|
4863
|
|
|
$$$1.fn[NAME].Constructor = Modal; |
|
4864
|
|
|
|
|
4865
|
|
|
$$$1.fn[NAME].noConflict = function () { |
|
4866
|
|
|
$$$1.fn[NAME] = JQUERY_NO_CONFLICT; |
|
4867
|
|
|
return Modal._jQueryInterface; |
|
4868
|
|
|
}; |
|
4869
|
|
|
|
|
4870
|
|
|
return Modal; |
|
4871
|
|
|
}($); |
|
4872
|
|
|
|
|
4873
|
|
|
/** |
|
4874
|
|
|
* -------------------------------------------------------------------------- |
|
4875
|
|
|
* Bootstrap (v4.0.0): tooltip.js |
|
4876
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
4877
|
|
|
* -------------------------------------------------------------------------- |
|
4878
|
|
|
*/ |
|
4879
|
|
|
|
|
4880
|
|
|
var Tooltip = function ($$$1) { |
|
4881
|
|
|
/** |
|
4882
|
|
|
* ------------------------------------------------------------------------ |
|
4883
|
|
|
* Constants |
|
4884
|
|
|
* ------------------------------------------------------------------------ |
|
4885
|
|
|
*/ |
|
4886
|
|
|
var NAME = 'tooltip'; |
|
4887
|
|
|
var VERSION = '4.0.0'; |
|
4888
|
|
|
var DATA_KEY = 'bs.tooltip'; |
|
4889
|
|
|
var EVENT_KEY = "." + DATA_KEY; |
|
4890
|
|
|
var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; |
|
4891
|
|
|
var TRANSITION_DURATION = 150; |
|
4892
|
|
|
var CLASS_PREFIX = 'bs-tooltip'; |
|
4893
|
|
|
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); |
|
4894
|
|
|
var DefaultType = { |
|
4895
|
|
|
animation: 'boolean', |
|
4896
|
|
|
template: 'string', |
|
4897
|
|
|
title: '(string|element|function)', |
|
4898
|
|
|
trigger: 'string', |
|
4899
|
|
|
delay: '(number|object)', |
|
4900
|
|
|
html: 'boolean', |
|
4901
|
|
|
selector: '(string|boolean)', |
|
4902
|
|
|
placement: '(string|function)', |
|
4903
|
|
|
offset: '(number|string)', |
|
4904
|
|
|
container: '(string|element|boolean)', |
|
4905
|
|
|
fallbackPlacement: '(string|array)', |
|
4906
|
|
|
boundary: '(string|element)' |
|
4907
|
|
|
}; |
|
4908
|
|
|
var AttachmentMap = { |
|
4909
|
|
|
AUTO: 'auto', |
|
4910
|
|
|
TOP: 'top', |
|
4911
|
|
|
RIGHT: 'right', |
|
4912
|
|
|
BOTTOM: 'bottom', |
|
4913
|
|
|
LEFT: 'left' |
|
4914
|
|
|
}; |
|
4915
|
|
|
var Default = { |
|
4916
|
|
|
animation: true, |
|
4917
|
|
|
template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', |
|
4918
|
|
|
trigger: 'hover focus', |
|
4919
|
|
|
title: '', |
|
4920
|
|
|
delay: 0, |
|
4921
|
|
|
html: false, |
|
4922
|
|
|
selector: false, |
|
4923
|
|
|
placement: 'top', |
|
4924
|
|
|
offset: 0, |
|
4925
|
|
|
container: false, |
|
4926
|
|
|
fallbackPlacement: 'flip', |
|
4927
|
|
|
boundary: 'scrollParent' |
|
4928
|
|
|
}; |
|
4929
|
|
|
var HoverState = { |
|
4930
|
|
|
SHOW: 'show', |
|
4931
|
|
|
OUT: 'out' |
|
4932
|
|
|
}; |
|
4933
|
|
|
var Event = { |
|
4934
|
|
|
HIDE: "hide" + EVENT_KEY, |
|
4935
|
|
|
HIDDEN: "hidden" + EVENT_KEY, |
|
4936
|
|
|
SHOW: "show" + EVENT_KEY, |
|
4937
|
|
|
SHOWN: "shown" + EVENT_KEY, |
|
4938
|
|
|
INSERTED: "inserted" + EVENT_KEY, |
|
4939
|
|
|
CLICK: "click" + EVENT_KEY, |
|
4940
|
|
|
FOCUSIN: "focusin" + EVENT_KEY, |
|
4941
|
|
|
FOCUSOUT: "focusout" + EVENT_KEY, |
|
4942
|
|
|
MOUSEENTER: "mouseenter" + EVENT_KEY, |
|
4943
|
|
|
MOUSELEAVE: "mouseleave" + EVENT_KEY |
|
4944
|
|
|
}; |
|
4945
|
|
|
var ClassName = { |
|
4946
|
|
|
FADE: 'fade', |
|
4947
|
|
|
SHOW: 'show' |
|
4948
|
|
|
}; |
|
4949
|
|
|
var Selector = { |
|
4950
|
|
|
TOOLTIP: '.tooltip', |
|
4951
|
|
|
TOOLTIP_INNER: '.tooltip-inner', |
|
4952
|
|
|
ARROW: '.arrow' |
|
4953
|
|
|
}; |
|
4954
|
|
|
var Trigger = { |
|
4955
|
|
|
HOVER: 'hover', |
|
4956
|
|
|
FOCUS: 'focus', |
|
4957
|
|
|
CLICK: 'click', |
|
4958
|
|
|
MANUAL: 'manual' |
|
4959
|
|
|
/** |
|
4960
|
|
|
* ------------------------------------------------------------------------ |
|
4961
|
|
|
* Class Definition |
|
4962
|
|
|
* ------------------------------------------------------------------------ |
|
4963
|
|
|
*/ |
|
4964
|
|
|
|
|
4965
|
|
|
}; |
|
4966
|
|
|
|
|
4967
|
|
|
var Tooltip = |
|
4968
|
|
|
/*#__PURE__*/ |
|
4969
|
|
|
function () { |
|
4970
|
|
|
function Tooltip(element, config) { |
|
4971
|
|
|
/** |
|
4972
|
|
|
* Check for Popper dependency |
|
4973
|
|
|
* Popper - https://popper.js.org |
|
4974
|
|
|
*/ |
|
4975
|
|
|
if (typeof Popper === 'undefined') { |
|
4976
|
|
|
throw new TypeError('Bootstrap tooltips require Popper.js (https://popper.js.org)'); |
|
4977
|
|
|
} // private |
|
4978
|
|
|
|
|
4979
|
|
|
|
|
4980
|
|
|
this._isEnabled = true; |
|
4981
|
|
|
this._timeout = 0; |
|
4982
|
|
|
this._hoverState = ''; |
|
4983
|
|
|
this._activeTrigger = {}; |
|
4984
|
|
|
this._popper = null; // Protected |
|
4985
|
|
|
|
|
4986
|
|
|
this.element = element; |
|
4987
|
|
|
this.config = this._getConfig(config); |
|
4988
|
|
|
this.tip = null; |
|
4989
|
|
|
|
|
4990
|
|
|
this._setListeners(); |
|
4991
|
|
|
} // Getters |
|
4992
|
|
|
|
|
4993
|
|
|
|
|
4994
|
|
|
var _proto = Tooltip.prototype; |
|
4995
|
|
|
|
|
4996
|
|
|
// Public |
|
4997
|
|
|
_proto.enable = function enable() { |
|
4998
|
|
|
this._isEnabled = true; |
|
4999
|
|
|
}; |
|
5000
|
|
|
|
|
5001
|
|
|
_proto.disable = function disable() { |
|
5002
|
|
|
this._isEnabled = false; |
|
5003
|
|
|
}; |
|
5004
|
|
|
|
|
5005
|
|
|
_proto.toggleEnabled = function toggleEnabled() { |
|
5006
|
|
|
this._isEnabled = !this._isEnabled; |
|
5007
|
|
|
}; |
|
5008
|
|
|
|
|
5009
|
|
|
_proto.toggle = function toggle(event) { |
|
5010
|
|
|
if (!this._isEnabled) { |
|
5011
|
|
|
return; |
|
5012
|
|
|
} |
|
5013
|
|
|
|
|
5014
|
|
|
if (event) { |
|
5015
|
|
|
var dataKey = this.constructor.DATA_KEY; |
|
5016
|
|
|
var context = $$$1(event.currentTarget).data(dataKey); |
|
5017
|
|
|
|
|
5018
|
|
|
if (!context) { |
|
5019
|
|
|
context = new this.constructor(event.currentTarget, this._getDelegateConfig()); |
|
5020
|
|
|
$$$1(event.currentTarget).data(dataKey, context); |
|
5021
|
|
|
} |
|
5022
|
|
|
|
|
5023
|
|
|
context._activeTrigger.click = !context._activeTrigger.click; |
|
5024
|
|
|
|
|
5025
|
|
|
if (context._isWithActiveTrigger()) { |
|
5026
|
|
|
context._enter(null, context); |
|
5027
|
|
|
} else { |
|
5028
|
|
|
context._leave(null, context); |
|
5029
|
|
|
} |
|
5030
|
|
|
} else { |
|
5031
|
|
|
if ($$$1(this.getTipElement()).hasClass(ClassName.SHOW)) { |
|
5032
|
|
|
this._leave(null, this); |
|
5033
|
|
|
|
|
5034
|
|
|
return; |
|
5035
|
|
|
} |
|
5036
|
|
|
|
|
5037
|
|
|
this._enter(null, this); |
|
5038
|
|
|
} |
|
5039
|
|
|
}; |
|
5040
|
|
|
|
|
5041
|
|
|
_proto.dispose = function dispose() { |
|
5042
|
|
|
clearTimeout(this._timeout); |
|
5043
|
|
|
$$$1.removeData(this.element, this.constructor.DATA_KEY); |
|
5044
|
|
|
$$$1(this.element).off(this.constructor.EVENT_KEY); |
|
5045
|
|
|
$$$1(this.element).closest('.modal').off('hide.bs.modal'); |
|
5046
|
|
|
|
|
5047
|
|
|
if (this.tip) { |
|
5048
|
|
|
$$$1(this.tip).remove(); |
|
5049
|
|
|
} |
|
5050
|
|
|
|
|
5051
|
|
|
this._isEnabled = null; |
|
5052
|
|
|
this._timeout = null; |
|
5053
|
|
|
this._hoverState = null; |
|
5054
|
|
|
this._activeTrigger = null; |
|
5055
|
|
|
|
|
5056
|
|
|
if (this._popper !== null) { |
|
5057
|
|
|
this._popper.destroy(); |
|
5058
|
|
|
} |
|
5059
|
|
|
|
|
5060
|
|
|
this._popper = null; |
|
5061
|
|
|
this.element = null; |
|
5062
|
|
|
this.config = null; |
|
5063
|
|
|
this.tip = null; |
|
5064
|
|
|
}; |
|
5065
|
|
|
|
|
5066
|
|
|
_proto.show = function show() { |
|
5067
|
|
|
var _this = this; |
|
5068
|
|
|
|
|
5069
|
|
|
if ($$$1(this.element).css('display') === 'none') { |
|
5070
|
|
|
throw new Error('Please use show on visible elements'); |
|
5071
|
|
|
} |
|
5072
|
|
|
|
|
5073
|
|
|
var showEvent = $$$1.Event(this.constructor.Event.SHOW); |
|
5074
|
|
|
|
|
5075
|
|
|
if (this.isWithContent() && this._isEnabled) { |
|
5076
|
|
|
$$$1(this.element).trigger(showEvent); |
|
5077
|
|
|
var isInTheDom = $$$1.contains(this.element.ownerDocument.documentElement, this.element); |
|
5078
|
|
|
|
|
5079
|
|
|
if (showEvent.isDefaultPrevented() || !isInTheDom) { |
|
5080
|
|
|
return; |
|
5081
|
|
|
} |
|
5082
|
|
|
|
|
5083
|
|
|
var tip = this.getTipElement(); |
|
5084
|
|
|
var tipId = Util.getUID(this.constructor.NAME); |
|
5085
|
|
|
tip.setAttribute('id', tipId); |
|
5086
|
|
|
this.element.setAttribute('aria-describedby', tipId); |
|
5087
|
|
|
this.setContent(); |
|
5088
|
|
|
|
|
5089
|
|
|
if (this.config.animation) { |
|
5090
|
|
|
$$$1(tip).addClass(ClassName.FADE); |
|
5091
|
|
|
} |
|
5092
|
|
|
|
|
5093
|
|
|
var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; |
|
5094
|
|
|
|
|
5095
|
|
|
var attachment = this._getAttachment(placement); |
|
5096
|
|
|
|
|
5097
|
|
|
this.addAttachmentClass(attachment); |
|
5098
|
|
|
var container = this.config.container === false ? document.body : $$$1(this.config.container); |
|
5099
|
|
|
$$$1(tip).data(this.constructor.DATA_KEY, this); |
|
5100
|
|
|
|
|
5101
|
|
|
if (!$$$1.contains(this.element.ownerDocument.documentElement, this.tip)) { |
|
5102
|
|
|
$$$1(tip).appendTo(container); |
|
5103
|
|
|
} |
|
5104
|
|
|
|
|
5105
|
|
|
$$$1(this.element).trigger(this.constructor.Event.INSERTED); |
|
5106
|
|
|
this._popper = new Popper(this.element, tip, { |
|
5107
|
|
|
placement: attachment, |
|
5108
|
|
|
modifiers: { |
|
5109
|
|
|
offset: { |
|
5110
|
|
|
offset: this.config.offset |
|
5111
|
|
|
}, |
|
5112
|
|
|
flip: { |
|
5113
|
|
|
behavior: this.config.fallbackPlacement |
|
5114
|
|
|
}, |
|
5115
|
|
|
arrow: { |
|
5116
|
|
|
element: Selector.ARROW |
|
5117
|
|
|
}, |
|
5118
|
|
|
preventOverflow: { |
|
5119
|
|
|
boundariesElement: this.config.boundary |
|
5120
|
|
|
} |
|
5121
|
|
|
}, |
|
5122
|
|
|
onCreate: function onCreate(data) { |
|
5123
|
|
|
if (data.originalPlacement !== data.placement) { |
|
5124
|
|
|
_this._handlePopperPlacementChange(data); |
|
5125
|
|
|
} |
|
5126
|
|
|
}, |
|
5127
|
|
|
onUpdate: function onUpdate(data) { |
|
5128
|
|
|
_this._handlePopperPlacementChange(data); |
|
5129
|
|
|
} |
|
5130
|
|
|
}); |
|
5131
|
|
|
$$$1(tip).addClass(ClassName.SHOW); // If this is a touch-enabled device we add extra |
|
5132
|
|
|
// empty mouseover listeners to the body's immediate children; |
|
5133
|
|
|
// only needed because of broken event delegation on iOS |
|
5134
|
|
|
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html |
|
5135
|
|
|
|
|
5136
|
|
|
if ('ontouchstart' in document.documentElement) { |
|
5137
|
|
|
$$$1('body').children().on('mouseover', null, $$$1.noop); |
|
5138
|
|
|
} |
|
5139
|
|
|
|
|
5140
|
|
|
var complete = function complete() { |
|
5141
|
|
|
if (_this.config.animation) { |
|
5142
|
|
|
_this._fixTransition(); |
|
5143
|
|
|
} |
|
5144
|
|
|
|
|
5145
|
|
|
var prevHoverState = _this._hoverState; |
|
5146
|
|
|
_this._hoverState = null; |
|
5147
|
|
|
$$$1(_this.element).trigger(_this.constructor.Event.SHOWN); |
|
5148
|
|
|
|
|
5149
|
|
|
if (prevHoverState === HoverState.OUT) { |
|
5150
|
|
|
_this._leave(null, _this); |
|
5151
|
|
|
} |
|
5152
|
|
|
}; |
|
5153
|
|
|
|
|
5154
|
|
|
if (Util.supportsTransitionEnd() && $$$1(this.tip).hasClass(ClassName.FADE)) { |
|
5155
|
|
|
$$$1(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION); |
|
5156
|
|
|
} else { |
|
5157
|
|
|
complete(); |
|
5158
|
|
|
} |
|
5159
|
|
|
} |
|
5160
|
|
|
}; |
|
5161
|
|
|
|
|
5162
|
|
|
_proto.hide = function hide(callback) { |
|
5163
|
|
|
var _this2 = this; |
|
5164
|
|
|
|
|
5165
|
|
|
var tip = this.getTipElement(); |
|
5166
|
|
|
var hideEvent = $$$1.Event(this.constructor.Event.HIDE); |
|
5167
|
|
|
|
|
5168
|
|
|
var complete = function complete() { |
|
5169
|
|
|
if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { |
|
5170
|
|
|
tip.parentNode.removeChild(tip); |
|
5171
|
|
|
} |
|
5172
|
|
|
|
|
5173
|
|
|
_this2._cleanTipClass(); |
|
5174
|
|
|
|
|
5175
|
|
|
_this2.element.removeAttribute('aria-describedby'); |
|
5176
|
|
|
|
|
5177
|
|
|
$$$1(_this2.element).trigger(_this2.constructor.Event.HIDDEN); |
|
5178
|
|
|
|
|
5179
|
|
|
if (_this2._popper !== null) { |
|
5180
|
|
|
_this2._popper.destroy(); |
|
5181
|
|
|
} |
|
5182
|
|
|
|
|
5183
|
|
|
if (callback) { |
|
5184
|
|
|
callback(); |
|
5185
|
|
|
} |
|
5186
|
|
|
}; |
|
5187
|
|
|
|
|
5188
|
|
|
$$$1(this.element).trigger(hideEvent); |
|
5189
|
|
|
|
|
5190
|
|
|
if (hideEvent.isDefaultPrevented()) { |
|
5191
|
|
|
return; |
|
5192
|
|
|
} |
|
5193
|
|
|
|
|
5194
|
|
|
$$$1(tip).removeClass(ClassName.SHOW); // If this is a touch-enabled device we remove the extra |
|
5195
|
|
|
// empty mouseover listeners we added for iOS support |
|
5196
|
|
|
|
|
5197
|
|
|
if ('ontouchstart' in document.documentElement) { |
|
5198
|
|
|
$$$1('body').children().off('mouseover', null, $$$1.noop); |
|
5199
|
|
|
} |
|
5200
|
|
|
|
|
5201
|
|
|
this._activeTrigger[Trigger.CLICK] = false; |
|
5202
|
|
|
this._activeTrigger[Trigger.FOCUS] = false; |
|
5203
|
|
|
this._activeTrigger[Trigger.HOVER] = false; |
|
5204
|
|
|
|
|
5205
|
|
|
if (Util.supportsTransitionEnd() && $$$1(this.tip).hasClass(ClassName.FADE)) { |
|
5206
|
|
|
$$$1(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); |
|
5207
|
|
|
} else { |
|
5208
|
|
|
complete(); |
|
5209
|
|
|
} |
|
5210
|
|
|
|
|
5211
|
|
|
this._hoverState = ''; |
|
5212
|
|
|
}; |
|
5213
|
|
|
|
|
5214
|
|
|
_proto.update = function update() { |
|
5215
|
|
|
if (this._popper !== null) { |
|
5216
|
|
|
this._popper.scheduleUpdate(); |
|
5217
|
|
|
} |
|
5218
|
|
|
}; // Protected |
|
5219
|
|
|
|
|
5220
|
|
|
|
|
5221
|
|
|
_proto.isWithContent = function isWithContent() { |
|
5222
|
|
|
return Boolean(this.getTitle()); |
|
5223
|
|
|
}; |
|
5224
|
|
|
|
|
5225
|
|
|
_proto.addAttachmentClass = function addAttachmentClass(attachment) { |
|
5226
|
|
|
$$$1(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); |
|
5227
|
|
|
}; |
|
5228
|
|
|
|
|
5229
|
|
|
_proto.getTipElement = function getTipElement() { |
|
5230
|
|
|
this.tip = this.tip || $$$1(this.config.template)[0]; |
|
5231
|
|
|
return this.tip; |
|
5232
|
|
|
}; |
|
5233
|
|
|
|
|
5234
|
|
|
_proto.setContent = function setContent() { |
|
5235
|
|
|
var $tip = $$$1(this.getTipElement()); |
|
5236
|
|
|
this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()); |
|
5237
|
|
|
$tip.removeClass(ClassName.FADE + " " + ClassName.SHOW); |
|
5238
|
|
|
}; |
|
5239
|
|
|
|
|
5240
|
|
|
_proto.setElementContent = function setElementContent($element, content) { |
|
5241
|
|
|
var html = this.config.html; |
|
5242
|
|
|
|
|
5243
|
|
|
if (typeof content === 'object' && (content.nodeType || content.jquery)) { |
|
5244
|
|
|
// Content is a DOM node or a jQuery |
|
5245
|
|
|
if (html) { |
|
5246
|
|
|
if (!$$$1(content).parent().is($element)) { |
|
5247
|
|
|
$element.empty().append(content); |
|
5248
|
|
|
} |
|
5249
|
|
|
} else { |
|
5250
|
|
|
$element.text($$$1(content).text()); |
|
5251
|
|
|
} |
|
5252
|
|
|
} else { |
|
5253
|
|
|
$element[html ? 'html' : 'text'](content); |
|
5254
|
|
|
} |
|
5255
|
|
|
}; |
|
5256
|
|
|
|
|
5257
|
|
|
_proto.getTitle = function getTitle() { |
|
5258
|
|
|
var title = this.element.getAttribute('data-original-title'); |
|
5259
|
|
|
|
|
5260
|
|
|
if (!title) { |
|
5261
|
|
|
title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; |
|
5262
|
|
|
} |
|
5263
|
|
|
|
|
5264
|
|
|
return title; |
|
5265
|
|
|
}; // Private |
|
5266
|
|
|
|
|
5267
|
|
|
|
|
5268
|
|
|
_proto._getAttachment = function _getAttachment(placement) { |
|
5269
|
|
|
return AttachmentMap[placement.toUpperCase()]; |
|
5270
|
|
|
}; |
|
5271
|
|
|
|
|
5272
|
|
|
_proto._setListeners = function _setListeners() { |
|
5273
|
|
|
var _this3 = this; |
|
5274
|
|
|
|
|
5275
|
|
|
var triggers = this.config.trigger.split(' '); |
|
5276
|
|
|
triggers.forEach(function (trigger) { |
|
5277
|
|
|
if (trigger === 'click') { |
|
5278
|
|
|
$$$1(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, function (event) { |
|
5279
|
|
|
return _this3.toggle(event); |
|
5280
|
|
|
}); |
|
5281
|
|
|
} else if (trigger !== Trigger.MANUAL) { |
|
5282
|
|
|
var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN; |
|
5283
|
|
|
var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT; |
|
5284
|
|
|
$$$1(_this3.element).on(eventIn, _this3.config.selector, function (event) { |
|
5285
|
|
|
return _this3._enter(event); |
|
5286
|
|
|
}).on(eventOut, _this3.config.selector, function (event) { |
|
5287
|
|
|
return _this3._leave(event); |
|
5288
|
|
|
}); |
|
5289
|
|
|
} |
|
5290
|
|
|
|
|
5291
|
|
|
$$$1(_this3.element).closest('.modal').on('hide.bs.modal', function () { |
|
5292
|
|
|
return _this3.hide(); |
|
5293
|
|
|
}); |
|
5294
|
|
|
}); |
|
5295
|
|
|
|
|
5296
|
|
|
if (this.config.selector) { |
|
5297
|
|
|
this.config = _extends({}, this.config, { |
|
5298
|
|
|
trigger: 'manual', |
|
5299
|
|
|
selector: '' |
|
5300
|
|
|
}); |
|
5301
|
|
|
} else { |
|
5302
|
|
|
this._fixTitle(); |
|
5303
|
|
|
} |
|
5304
|
|
|
}; |
|
5305
|
|
|
|
|
5306
|
|
|
_proto._fixTitle = function _fixTitle() { |
|
5307
|
|
|
var titleType = typeof this.element.getAttribute('data-original-title'); |
|
5308
|
|
|
|
|
5309
|
|
|
if (this.element.getAttribute('title') || titleType !== 'string') { |
|
5310
|
|
|
this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); |
|
5311
|
|
|
this.element.setAttribute('title', ''); |
|
5312
|
|
|
} |
|
5313
|
|
|
}; |
|
5314
|
|
|
|
|
5315
|
|
|
_proto._enter = function _enter(event, context) { |
|
5316
|
|
|
var dataKey = this.constructor.DATA_KEY; |
|
5317
|
|
|
context = context || $$$1(event.currentTarget).data(dataKey); |
|
5318
|
|
|
|
|
5319
|
|
|
if (!context) { |
|
5320
|
|
|
context = new this.constructor(event.currentTarget, this._getDelegateConfig()); |
|
5321
|
|
|
$$$1(event.currentTarget).data(dataKey, context); |
|
5322
|
|
|
} |
|
5323
|
|
|
|
|
5324
|
|
|
if (event) { |
|
5325
|
|
|
context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; |
|
5326
|
|
|
} |
|
5327
|
|
|
|
|
5328
|
|
|
if ($$$1(context.getTipElement()).hasClass(ClassName.SHOW) || context._hoverState === HoverState.SHOW) { |
|
5329
|
|
|
context._hoverState = HoverState.SHOW; |
|
5330
|
|
|
return; |
|
5331
|
|
|
} |
|
5332
|
|
|
|
|
5333
|
|
|
clearTimeout(context._timeout); |
|
5334
|
|
|
context._hoverState = HoverState.SHOW; |
|
5335
|
|
|
|
|
5336
|
|
|
if (!context.config.delay || !context.config.delay.show) { |
|
5337
|
|
|
context.show(); |
|
5338
|
|
|
return; |
|
5339
|
|
|
} |
|
5340
|
|
|
|
|
5341
|
|
|
context._timeout = setTimeout(function () { |
|
5342
|
|
|
if (context._hoverState === HoverState.SHOW) { |
|
5343
|
|
|
context.show(); |
|
5344
|
|
|
} |
|
5345
|
|
|
}, context.config.delay.show); |
|
5346
|
|
|
}; |
|
5347
|
|
|
|
|
5348
|
|
|
_proto._leave = function _leave(event, context) { |
|
5349
|
|
|
var dataKey = this.constructor.DATA_KEY; |
|
5350
|
|
|
context = context || $$$1(event.currentTarget).data(dataKey); |
|
5351
|
|
|
|
|
5352
|
|
|
if (!context) { |
|
5353
|
|
|
context = new this.constructor(event.currentTarget, this._getDelegateConfig()); |
|
5354
|
|
|
$$$1(event.currentTarget).data(dataKey, context); |
|
5355
|
|
|
} |
|
5356
|
|
|
|
|
5357
|
|
|
if (event) { |
|
5358
|
|
|
context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false; |
|
5359
|
|
|
} |
|
5360
|
|
|
|
|
5361
|
|
|
if (context._isWithActiveTrigger()) { |
|
5362
|
|
|
return; |
|
5363
|
|
|
} |
|
5364
|
|
|
|
|
5365
|
|
|
clearTimeout(context._timeout); |
|
5366
|
|
|
context._hoverState = HoverState.OUT; |
|
5367
|
|
|
|
|
5368
|
|
|
if (!context.config.delay || !context.config.delay.hide) { |
|
5369
|
|
|
context.hide(); |
|
5370
|
|
|
return; |
|
5371
|
|
|
} |
|
5372
|
|
|
|
|
5373
|
|
|
context._timeout = setTimeout(function () { |
|
5374
|
|
|
if (context._hoverState === HoverState.OUT) { |
|
5375
|
|
|
context.hide(); |
|
5376
|
|
|
} |
|
5377
|
|
|
}, context.config.delay.hide); |
|
5378
|
|
|
}; |
|
5379
|
|
|
|
|
5380
|
|
|
_proto._isWithActiveTrigger = function _isWithActiveTrigger() { |
|
5381
|
|
|
for (var trigger in this._activeTrigger) { |
|
|
|
|
|
|
5382
|
|
|
if (this._activeTrigger[trigger]) { |
|
5383
|
|
|
return true; |
|
5384
|
|
|
} |
|
5385
|
|
|
} |
|
5386
|
|
|
|
|
5387
|
|
|
return false; |
|
5388
|
|
|
}; |
|
5389
|
|
|
|
|
5390
|
|
|
_proto._getConfig = function _getConfig(config) { |
|
5391
|
|
|
config = _extends({}, this.constructor.Default, $$$1(this.element).data(), config); |
|
5392
|
|
|
|
|
5393
|
|
|
if (typeof config.delay === 'number') { |
|
5394
|
|
|
config.delay = { |
|
5395
|
|
|
show: config.delay, |
|
5396
|
|
|
hide: config.delay |
|
5397
|
|
|
}; |
|
5398
|
|
|
} |
|
5399
|
|
|
|
|
5400
|
|
|
if (typeof config.title === 'number') { |
|
5401
|
|
|
config.title = config.title.toString(); |
|
5402
|
|
|
} |
|
5403
|
|
|
|
|
5404
|
|
|
if (typeof config.content === 'number') { |
|
5405
|
|
|
config.content = config.content.toString(); |
|
5406
|
|
|
} |
|
5407
|
|
|
|
|
5408
|
|
|
Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); |
|
5409
|
|
|
return config; |
|
5410
|
|
|
}; |
|
5411
|
|
|
|
|
5412
|
|
|
_proto._getDelegateConfig = function _getDelegateConfig() { |
|
5413
|
|
|
var config = {}; |
|
5414
|
|
|
|
|
5415
|
|
|
if (this.config) { |
|
5416
|
|
|
for (var key in this.config) { |
|
|
|
|
|
|
5417
|
|
|
if (this.constructor.Default[key] !== this.config[key]) { |
|
5418
|
|
|
config[key] = this.config[key]; |
|
5419
|
|
|
} |
|
5420
|
|
|
} |
|
5421
|
|
|
} |
|
5422
|
|
|
|
|
5423
|
|
|
return config; |
|
5424
|
|
|
}; |
|
5425
|
|
|
|
|
5426
|
|
|
_proto._cleanTipClass = function _cleanTipClass() { |
|
5427
|
|
|
var $tip = $$$1(this.getTipElement()); |
|
5428
|
|
|
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); |
|
5429
|
|
|
|
|
5430
|
|
|
if (tabClass !== null && tabClass.length > 0) { |
|
5431
|
|
|
$tip.removeClass(tabClass.join('')); |
|
5432
|
|
|
} |
|
5433
|
|
|
}; |
|
5434
|
|
|
|
|
5435
|
|
|
_proto._handlePopperPlacementChange = function _handlePopperPlacementChange(data) { |
|
5436
|
|
|
this._cleanTipClass(); |
|
5437
|
|
|
|
|
5438
|
|
|
this.addAttachmentClass(this._getAttachment(data.placement)); |
|
5439
|
|
|
}; |
|
5440
|
|
|
|
|
5441
|
|
|
_proto._fixTransition = function _fixTransition() { |
|
5442
|
|
|
var tip = this.getTipElement(); |
|
5443
|
|
|
var initConfigAnimation = this.config.animation; |
|
5444
|
|
|
|
|
5445
|
|
|
if (tip.getAttribute('x-placement') !== null) { |
|
5446
|
|
|
return; |
|
5447
|
|
|
} |
|
5448
|
|
|
|
|
5449
|
|
|
$$$1(tip).removeClass(ClassName.FADE); |
|
5450
|
|
|
this.config.animation = false; |
|
5451
|
|
|
this.hide(); |
|
5452
|
|
|
this.show(); |
|
5453
|
|
|
this.config.animation = initConfigAnimation; |
|
5454
|
|
|
}; // Static |
|
5455
|
|
|
|
|
5456
|
|
|
|
|
5457
|
|
|
Tooltip._jQueryInterface = function _jQueryInterface(config) { |
|
5458
|
|
|
return this.each(function () { |
|
5459
|
|
|
var data = $$$1(this).data(DATA_KEY); |
|
5460
|
|
|
|
|
5461
|
|
|
var _config = typeof config === 'object' && config; |
|
5462
|
|
|
|
|
5463
|
|
|
if (!data && /dispose|hide/.test(config)) { |
|
5464
|
|
|
return; |
|
5465
|
|
|
} |
|
5466
|
|
|
|
|
5467
|
|
|
if (!data) { |
|
5468
|
|
|
data = new Tooltip(this, _config); |
|
5469
|
|
|
$$$1(this).data(DATA_KEY, data); |
|
5470
|
|
|
} |
|
5471
|
|
|
|
|
5472
|
|
|
if (typeof config === 'string') { |
|
5473
|
|
|
if (typeof data[config] === 'undefined') { |
|
5474
|
|
|
throw new TypeError("No method named \"" + config + "\""); |
|
5475
|
|
|
} |
|
5476
|
|
|
|
|
5477
|
|
|
data[config](); |
|
5478
|
|
|
} |
|
5479
|
|
|
}); |
|
5480
|
|
|
}; |
|
5481
|
|
|
|
|
5482
|
|
|
_createClass(Tooltip, null, [{ |
|
5483
|
|
|
key: "VERSION", |
|
5484
|
|
|
get: function get() { |
|
5485
|
|
|
return VERSION; |
|
5486
|
|
|
} |
|
5487
|
|
|
}, { |
|
5488
|
|
|
key: "Default", |
|
5489
|
|
|
get: function get() { |
|
5490
|
|
|
return Default; |
|
5491
|
|
|
} |
|
5492
|
|
|
}, { |
|
5493
|
|
|
key: "NAME", |
|
5494
|
|
|
get: function get() { |
|
5495
|
|
|
return NAME; |
|
5496
|
|
|
} |
|
5497
|
|
|
}, { |
|
5498
|
|
|
key: "DATA_KEY", |
|
5499
|
|
|
get: function get() { |
|
5500
|
|
|
return DATA_KEY; |
|
5501
|
|
|
} |
|
5502
|
|
|
}, { |
|
5503
|
|
|
key: "Event", |
|
5504
|
|
|
get: function get() { |
|
5505
|
|
|
return Event; |
|
5506
|
|
|
} |
|
5507
|
|
|
}, { |
|
5508
|
|
|
key: "EVENT_KEY", |
|
5509
|
|
|
get: function get() { |
|
5510
|
|
|
return EVENT_KEY; |
|
5511
|
|
|
} |
|
5512
|
|
|
}, { |
|
5513
|
|
|
key: "DefaultType", |
|
5514
|
|
|
get: function get() { |
|
5515
|
|
|
return DefaultType; |
|
5516
|
|
|
} |
|
5517
|
|
|
}]); |
|
5518
|
|
|
return Tooltip; |
|
5519
|
|
|
}(); |
|
5520
|
|
|
/** |
|
5521
|
|
|
* ------------------------------------------------------------------------ |
|
5522
|
|
|
* jQuery |
|
5523
|
|
|
* ------------------------------------------------------------------------ |
|
5524
|
|
|
*/ |
|
5525
|
|
|
|
|
5526
|
|
|
|
|
5527
|
|
|
$$$1.fn[NAME] = Tooltip._jQueryInterface; |
|
5528
|
|
|
$$$1.fn[NAME].Constructor = Tooltip; |
|
5529
|
|
|
|
|
5530
|
|
|
$$$1.fn[NAME].noConflict = function () { |
|
5531
|
|
|
$$$1.fn[NAME] = JQUERY_NO_CONFLICT; |
|
5532
|
|
|
return Tooltip._jQueryInterface; |
|
5533
|
|
|
}; |
|
5534
|
|
|
|
|
5535
|
|
|
return Tooltip; |
|
5536
|
|
|
}($, Popper); |
|
5537
|
|
|
|
|
5538
|
|
|
/** |
|
5539
|
|
|
* -------------------------------------------------------------------------- |
|
5540
|
|
|
* Bootstrap (v4.0.0): popover.js |
|
5541
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
5542
|
|
|
* -------------------------------------------------------------------------- |
|
5543
|
|
|
*/ |
|
5544
|
|
|
|
|
5545
|
|
|
var Popover = function ($$$1) { |
|
5546
|
|
|
/** |
|
5547
|
|
|
* ------------------------------------------------------------------------ |
|
5548
|
|
|
* Constants |
|
5549
|
|
|
* ------------------------------------------------------------------------ |
|
5550
|
|
|
*/ |
|
5551
|
|
|
var NAME = 'popover'; |
|
5552
|
|
|
var VERSION = '4.0.0'; |
|
5553
|
|
|
var DATA_KEY = 'bs.popover'; |
|
5554
|
|
|
var EVENT_KEY = "." + DATA_KEY; |
|
5555
|
|
|
var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; |
|
5556
|
|
|
var CLASS_PREFIX = 'bs-popover'; |
|
5557
|
|
|
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); |
|
5558
|
|
|
var Default = _extends({}, Tooltip.Default, { |
|
5559
|
|
|
placement: 'right', |
|
5560
|
|
|
trigger: 'click', |
|
5561
|
|
|
content: '', |
|
5562
|
|
|
template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' |
|
5563
|
|
|
}); |
|
5564
|
|
|
var DefaultType = _extends({}, Tooltip.DefaultType, { |
|
5565
|
|
|
content: '(string|element|function)' |
|
5566
|
|
|
}); |
|
5567
|
|
|
var ClassName = { |
|
5568
|
|
|
FADE: 'fade', |
|
5569
|
|
|
SHOW: 'show' |
|
5570
|
|
|
}; |
|
5571
|
|
|
var Selector = { |
|
5572
|
|
|
TITLE: '.popover-header', |
|
5573
|
|
|
CONTENT: '.popover-body' |
|
5574
|
|
|
}; |
|
5575
|
|
|
var Event = { |
|
5576
|
|
|
HIDE: "hide" + EVENT_KEY, |
|
5577
|
|
|
HIDDEN: "hidden" + EVENT_KEY, |
|
5578
|
|
|
SHOW: "show" + EVENT_KEY, |
|
5579
|
|
|
SHOWN: "shown" + EVENT_KEY, |
|
5580
|
|
|
INSERTED: "inserted" + EVENT_KEY, |
|
5581
|
|
|
CLICK: "click" + EVENT_KEY, |
|
5582
|
|
|
FOCUSIN: "focusin" + EVENT_KEY, |
|
5583
|
|
|
FOCUSOUT: "focusout" + EVENT_KEY, |
|
5584
|
|
|
MOUSEENTER: "mouseenter" + EVENT_KEY, |
|
5585
|
|
|
MOUSELEAVE: "mouseleave" + EVENT_KEY |
|
5586
|
|
|
/** |
|
5587
|
|
|
* ------------------------------------------------------------------------ |
|
5588
|
|
|
* Class Definition |
|
5589
|
|
|
* ------------------------------------------------------------------------ |
|
5590
|
|
|
*/ |
|
5591
|
|
|
|
|
5592
|
|
|
}; |
|
5593
|
|
|
|
|
5594
|
|
|
var Popover = |
|
5595
|
|
|
/*#__PURE__*/ |
|
5596
|
|
|
function (_Tooltip) { |
|
5597
|
|
|
_inheritsLoose(Popover, _Tooltip); |
|
5598
|
|
|
|
|
5599
|
|
|
function Popover() { |
|
5600
|
|
|
return _Tooltip.apply(this, arguments) || this; |
|
5601
|
|
|
} |
|
5602
|
|
|
|
|
5603
|
|
|
var _proto = Popover.prototype; |
|
5604
|
|
|
|
|
5605
|
|
|
// Overrides |
|
5606
|
|
|
_proto.isWithContent = function isWithContent() { |
|
5607
|
|
|
return this.getTitle() || this._getContent(); |
|
5608
|
|
|
}; |
|
5609
|
|
|
|
|
5610
|
|
|
_proto.addAttachmentClass = function addAttachmentClass(attachment) { |
|
5611
|
|
|
$$$1(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); |
|
5612
|
|
|
}; |
|
5613
|
|
|
|
|
5614
|
|
|
_proto.getTipElement = function getTipElement() { |
|
5615
|
|
|
this.tip = this.tip || $$$1(this.config.template)[0]; |
|
5616
|
|
|
return this.tip; |
|
5617
|
|
|
}; |
|
5618
|
|
|
|
|
5619
|
|
|
_proto.setContent = function setContent() { |
|
5620
|
|
|
var $tip = $$$1(this.getTipElement()); // We use append for html objects to maintain js events |
|
5621
|
|
|
|
|
5622
|
|
|
this.setElementContent($tip.find(Selector.TITLE), this.getTitle()); |
|
5623
|
|
|
|
|
5624
|
|
|
var content = this._getContent(); |
|
5625
|
|
|
|
|
5626
|
|
|
if (typeof content === 'function') { |
|
5627
|
|
|
content = content.call(this.element); |
|
5628
|
|
|
} |
|
5629
|
|
|
|
|
5630
|
|
|
this.setElementContent($tip.find(Selector.CONTENT), content); |
|
5631
|
|
|
$tip.removeClass(ClassName.FADE + " " + ClassName.SHOW); |
|
5632
|
|
|
}; // Private |
|
5633
|
|
|
|
|
5634
|
|
|
|
|
5635
|
|
|
_proto._getContent = function _getContent() { |
|
5636
|
|
|
return this.element.getAttribute('data-content') || this.config.content; |
|
5637
|
|
|
}; |
|
5638
|
|
|
|
|
5639
|
|
|
_proto._cleanTipClass = function _cleanTipClass() { |
|
5640
|
|
|
var $tip = $$$1(this.getTipElement()); |
|
5641
|
|
|
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); |
|
5642
|
|
|
|
|
5643
|
|
|
if (tabClass !== null && tabClass.length > 0) { |
|
5644
|
|
|
$tip.removeClass(tabClass.join('')); |
|
5645
|
|
|
} |
|
5646
|
|
|
}; // Static |
|
5647
|
|
|
|
|
5648
|
|
|
|
|
5649
|
|
|
Popover._jQueryInterface = function _jQueryInterface(config) { |
|
5650
|
|
|
return this.each(function () { |
|
5651
|
|
|
var data = $$$1(this).data(DATA_KEY); |
|
5652
|
|
|
|
|
5653
|
|
|
var _config = typeof config === 'object' ? config : null; |
|
5654
|
|
|
|
|
5655
|
|
|
if (!data && /destroy|hide/.test(config)) { |
|
5656
|
|
|
return; |
|
5657
|
|
|
} |
|
5658
|
|
|
|
|
5659
|
|
|
if (!data) { |
|
5660
|
|
|
data = new Popover(this, _config); |
|
5661
|
|
|
$$$1(this).data(DATA_KEY, data); |
|
5662
|
|
|
} |
|
5663
|
|
|
|
|
5664
|
|
|
if (typeof config === 'string') { |
|
5665
|
|
|
if (typeof data[config] === 'undefined') { |
|
5666
|
|
|
throw new TypeError("No method named \"" + config + "\""); |
|
5667
|
|
|
} |
|
5668
|
|
|
|
|
5669
|
|
|
data[config](); |
|
5670
|
|
|
} |
|
5671
|
|
|
}); |
|
5672
|
|
|
}; |
|
5673
|
|
|
|
|
5674
|
|
|
_createClass(Popover, null, [{ |
|
5675
|
|
|
key: "VERSION", |
|
5676
|
|
|
// Getters |
|
5677
|
|
|
get: function get() { |
|
5678
|
|
|
return VERSION; |
|
5679
|
|
|
} |
|
5680
|
|
|
}, { |
|
5681
|
|
|
key: "Default", |
|
5682
|
|
|
get: function get() { |
|
5683
|
|
|
return Default; |
|
5684
|
|
|
} |
|
5685
|
|
|
}, { |
|
5686
|
|
|
key: "NAME", |
|
5687
|
|
|
get: function get() { |
|
5688
|
|
|
return NAME; |
|
5689
|
|
|
} |
|
5690
|
|
|
}, { |
|
5691
|
|
|
key: "DATA_KEY", |
|
5692
|
|
|
get: function get() { |
|
5693
|
|
|
return DATA_KEY; |
|
5694
|
|
|
} |
|
5695
|
|
|
}, { |
|
5696
|
|
|
key: "Event", |
|
5697
|
|
|
get: function get() { |
|
5698
|
|
|
return Event; |
|
5699
|
|
|
} |
|
5700
|
|
|
}, { |
|
5701
|
|
|
key: "EVENT_KEY", |
|
5702
|
|
|
get: function get() { |
|
5703
|
|
|
return EVENT_KEY; |
|
5704
|
|
|
} |
|
5705
|
|
|
}, { |
|
5706
|
|
|
key: "DefaultType", |
|
5707
|
|
|
get: function get() { |
|
5708
|
|
|
return DefaultType; |
|
5709
|
|
|
} |
|
5710
|
|
|
}]); |
|
5711
|
|
|
return Popover; |
|
5712
|
|
|
}(Tooltip); |
|
5713
|
|
|
/** |
|
5714
|
|
|
* ------------------------------------------------------------------------ |
|
5715
|
|
|
* jQuery |
|
5716
|
|
|
* ------------------------------------------------------------------------ |
|
5717
|
|
|
*/ |
|
5718
|
|
|
|
|
5719
|
|
|
|
|
5720
|
|
|
$$$1.fn[NAME] = Popover._jQueryInterface; |
|
5721
|
|
|
$$$1.fn[NAME].Constructor = Popover; |
|
5722
|
|
|
|
|
5723
|
|
|
$$$1.fn[NAME].noConflict = function () { |
|
5724
|
|
|
$$$1.fn[NAME] = JQUERY_NO_CONFLICT; |
|
5725
|
|
|
return Popover._jQueryInterface; |
|
5726
|
|
|
}; |
|
5727
|
|
|
|
|
5728
|
|
|
return Popover; |
|
5729
|
|
|
}($); |
|
5730
|
|
|
|
|
5731
|
|
|
/** |
|
5732
|
|
|
* -------------------------------------------------------------------------- |
|
5733
|
|
|
* Bootstrap (v4.0.0): scrollspy.js |
|
5734
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
5735
|
|
|
* -------------------------------------------------------------------------- |
|
5736
|
|
|
*/ |
|
5737
|
|
|
|
|
5738
|
|
|
var ScrollSpy = function ($$$1) { |
|
5739
|
|
|
/** |
|
5740
|
|
|
* ------------------------------------------------------------------------ |
|
5741
|
|
|
* Constants |
|
5742
|
|
|
* ------------------------------------------------------------------------ |
|
5743
|
|
|
*/ |
|
5744
|
|
|
var NAME = 'scrollspy'; |
|
5745
|
|
|
var VERSION = '4.0.0'; |
|
5746
|
|
|
var DATA_KEY = 'bs.scrollspy'; |
|
5747
|
|
|
var EVENT_KEY = "." + DATA_KEY; |
|
5748
|
|
|
var DATA_API_KEY = '.data-api'; |
|
5749
|
|
|
var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; |
|
5750
|
|
|
var Default = { |
|
5751
|
|
|
offset: 10, |
|
5752
|
|
|
method: 'auto', |
|
5753
|
|
|
target: '' |
|
5754
|
|
|
}; |
|
5755
|
|
|
var DefaultType = { |
|
5756
|
|
|
offset: 'number', |
|
5757
|
|
|
method: 'string', |
|
5758
|
|
|
target: '(string|element)' |
|
5759
|
|
|
}; |
|
5760
|
|
|
var Event = { |
|
5761
|
|
|
ACTIVATE: "activate" + EVENT_KEY, |
|
5762
|
|
|
SCROLL: "scroll" + EVENT_KEY, |
|
5763
|
|
|
LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY |
|
5764
|
|
|
}; |
|
5765
|
|
|
var ClassName = { |
|
5766
|
|
|
DROPDOWN_ITEM: 'dropdown-item', |
|
5767
|
|
|
DROPDOWN_MENU: 'dropdown-menu', |
|
5768
|
|
|
ACTIVE: 'active' |
|
5769
|
|
|
}; |
|
5770
|
|
|
var Selector = { |
|
5771
|
|
|
DATA_SPY: '[data-spy="scroll"]', |
|
5772
|
|
|
ACTIVE: '.active', |
|
5773
|
|
|
NAV_LIST_GROUP: '.nav, .list-group', |
|
5774
|
|
|
NAV_LINKS: '.nav-link', |
|
5775
|
|
|
NAV_ITEMS: '.nav-item', |
|
5776
|
|
|
LIST_ITEMS: '.list-group-item', |
|
5777
|
|
|
DROPDOWN: '.dropdown', |
|
5778
|
|
|
DROPDOWN_ITEMS: '.dropdown-item', |
|
5779
|
|
|
DROPDOWN_TOGGLE: '.dropdown-toggle' |
|
5780
|
|
|
}; |
|
5781
|
|
|
var OffsetMethod = { |
|
5782
|
|
|
OFFSET: 'offset', |
|
5783
|
|
|
POSITION: 'position' |
|
5784
|
|
|
/** |
|
5785
|
|
|
* ------------------------------------------------------------------------ |
|
5786
|
|
|
* Class Definition |
|
5787
|
|
|
* ------------------------------------------------------------------------ |
|
5788
|
|
|
*/ |
|
5789
|
|
|
|
|
5790
|
|
|
}; |
|
5791
|
|
|
|
|
5792
|
|
|
var ScrollSpy = |
|
5793
|
|
|
/*#__PURE__*/ |
|
5794
|
|
|
function () { |
|
5795
|
|
|
function ScrollSpy(element, config) { |
|
5796
|
|
|
var _this = this; |
|
5797
|
|
|
|
|
5798
|
|
|
this._element = element; |
|
5799
|
|
|
this._scrollElement = element.tagName === 'BODY' ? window : element; |
|
5800
|
|
|
this._config = this._getConfig(config); |
|
5801
|
|
|
this._selector = this._config.target + " " + Selector.NAV_LINKS + "," + (this._config.target + " " + Selector.LIST_ITEMS + ",") + (this._config.target + " " + Selector.DROPDOWN_ITEMS); |
|
5802
|
|
|
this._offsets = []; |
|
5803
|
|
|
this._targets = []; |
|
5804
|
|
|
this._activeTarget = null; |
|
5805
|
|
|
this._scrollHeight = 0; |
|
5806
|
|
|
$$$1(this._scrollElement).on(Event.SCROLL, function (event) { |
|
5807
|
|
|
return _this._process(event); |
|
5808
|
|
|
}); |
|
5809
|
|
|
this.refresh(); |
|
5810
|
|
|
|
|
5811
|
|
|
this._process(); |
|
5812
|
|
|
} // Getters |
|
5813
|
|
|
|
|
5814
|
|
|
|
|
5815
|
|
|
var _proto = ScrollSpy.prototype; |
|
5816
|
|
|
|
|
5817
|
|
|
// Public |
|
5818
|
|
|
_proto.refresh = function refresh() { |
|
5819
|
|
|
var _this2 = this; |
|
5820
|
|
|
|
|
5821
|
|
|
var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION; |
|
5822
|
|
|
var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; |
|
5823
|
|
|
var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; |
|
5824
|
|
|
this._offsets = []; |
|
5825
|
|
|
this._targets = []; |
|
5826
|
|
|
this._scrollHeight = this._getScrollHeight(); |
|
5827
|
|
|
var targets = $$$1.makeArray($$$1(this._selector)); |
|
5828
|
|
|
targets.map(function (element) { |
|
5829
|
|
|
var target; |
|
5830
|
|
|
var targetSelector = Util.getSelectorFromElement(element); |
|
5831
|
|
|
|
|
5832
|
|
|
if (targetSelector) { |
|
5833
|
|
|
target = $$$1(targetSelector)[0]; |
|
5834
|
|
|
} |
|
5835
|
|
|
|
|
5836
|
|
|
if (target) { |
|
5837
|
|
|
var targetBCR = target.getBoundingClientRect(); |
|
5838
|
|
|
|
|
5839
|
|
|
if (targetBCR.width || targetBCR.height) { |
|
5840
|
|
|
// TODO (fat): remove sketch reliance on jQuery position/offset |
|
5841
|
|
|
return [$$$1(target)[offsetMethod]().top + offsetBase, targetSelector]; |
|
5842
|
|
|
} |
|
5843
|
|
|
} |
|
5844
|
|
|
|
|
5845
|
|
|
return null; |
|
5846
|
|
|
}).filter(function (item) { |
|
5847
|
|
|
return item; |
|
5848
|
|
|
}).sort(function (a, b) { |
|
5849
|
|
|
return a[0] - b[0]; |
|
5850
|
|
|
}).forEach(function (item) { |
|
5851
|
|
|
_this2._offsets.push(item[0]); |
|
5852
|
|
|
|
|
5853
|
|
|
_this2._targets.push(item[1]); |
|
5854
|
|
|
}); |
|
5855
|
|
|
}; |
|
5856
|
|
|
|
|
5857
|
|
|
_proto.dispose = function dispose() { |
|
5858
|
|
|
$$$1.removeData(this._element, DATA_KEY); |
|
5859
|
|
|
$$$1(this._scrollElement).off(EVENT_KEY); |
|
5860
|
|
|
this._element = null; |
|
5861
|
|
|
this._scrollElement = null; |
|
5862
|
|
|
this._config = null; |
|
5863
|
|
|
this._selector = null; |
|
5864
|
|
|
this._offsets = null; |
|
5865
|
|
|
this._targets = null; |
|
5866
|
|
|
this._activeTarget = null; |
|
5867
|
|
|
this._scrollHeight = null; |
|
5868
|
|
|
}; // Private |
|
5869
|
|
|
|
|
5870
|
|
|
|
|
5871
|
|
|
_proto._getConfig = function _getConfig(config) { |
|
5872
|
|
|
config = _extends({}, Default, config); |
|
5873
|
|
|
|
|
5874
|
|
|
if (typeof config.target !== 'string') { |
|
5875
|
|
|
var id = $$$1(config.target).attr('id'); |
|
5876
|
|
|
|
|
5877
|
|
|
if (!id) { |
|
5878
|
|
|
id = Util.getUID(NAME); |
|
5879
|
|
|
$$$1(config.target).attr('id', id); |
|
5880
|
|
|
} |
|
5881
|
|
|
|
|
5882
|
|
|
config.target = "#" + id; |
|
5883
|
|
|
} |
|
5884
|
|
|
|
|
5885
|
|
|
Util.typeCheckConfig(NAME, config, DefaultType); |
|
5886
|
|
|
return config; |
|
5887
|
|
|
}; |
|
5888
|
|
|
|
|
5889
|
|
|
_proto._getScrollTop = function _getScrollTop() { |
|
5890
|
|
|
return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; |
|
5891
|
|
|
}; |
|
5892
|
|
|
|
|
5893
|
|
|
_proto._getScrollHeight = function _getScrollHeight() { |
|
5894
|
|
|
return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); |
|
5895
|
|
|
}; |
|
5896
|
|
|
|
|
5897
|
|
|
_proto._getOffsetHeight = function _getOffsetHeight() { |
|
5898
|
|
|
return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; |
|
5899
|
|
|
}; |
|
5900
|
|
|
|
|
5901
|
|
|
_proto._process = function _process() { |
|
5902
|
|
|
var scrollTop = this._getScrollTop() + this._config.offset; |
|
5903
|
|
|
|
|
5904
|
|
|
var scrollHeight = this._getScrollHeight(); |
|
5905
|
|
|
|
|
5906
|
|
|
var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); |
|
5907
|
|
|
|
|
5908
|
|
|
if (this._scrollHeight !== scrollHeight) { |
|
5909
|
|
|
this.refresh(); |
|
5910
|
|
|
} |
|
5911
|
|
|
|
|
5912
|
|
|
if (scrollTop >= maxScroll) { |
|
5913
|
|
|
var target = this._targets[this._targets.length - 1]; |
|
5914
|
|
|
|
|
5915
|
|
|
if (this._activeTarget !== target) { |
|
5916
|
|
|
this._activate(target); |
|
5917
|
|
|
} |
|
5918
|
|
|
|
|
5919
|
|
|
return; |
|
5920
|
|
|
} |
|
5921
|
|
|
|
|
5922
|
|
|
if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { |
|
5923
|
|
|
this._activeTarget = null; |
|
5924
|
|
|
|
|
5925
|
|
|
this._clear(); |
|
5926
|
|
|
|
|
5927
|
|
|
return; |
|
5928
|
|
|
} |
|
5929
|
|
|
|
|
5930
|
|
|
for (var i = this._offsets.length; i--;) { |
|
5931
|
|
|
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); |
|
5932
|
|
|
|
|
5933
|
|
|
if (isActiveTarget) { |
|
5934
|
|
|
this._activate(this._targets[i]); |
|
5935
|
|
|
} |
|
5936
|
|
|
} |
|
5937
|
|
|
}; |
|
5938
|
|
|
|
|
5939
|
|
|
_proto._activate = function _activate(target) { |
|
5940
|
|
|
this._activeTarget = target; |
|
5941
|
|
|
|
|
5942
|
|
|
this._clear(); |
|
5943
|
|
|
|
|
5944
|
|
|
var queries = this._selector.split(','); // eslint-disable-next-line arrow-body-style |
|
5945
|
|
|
|
|
5946
|
|
|
|
|
5947
|
|
|
queries = queries.map(function (selector) { |
|
5948
|
|
|
return selector + "[data-target=\"" + target + "\"]," + (selector + "[href=\"" + target + "\"]"); |
|
5949
|
|
|
}); |
|
5950
|
|
|
var $link = $$$1(queries.join(',')); |
|
5951
|
|
|
|
|
5952
|
|
|
if ($link.hasClass(ClassName.DROPDOWN_ITEM)) { |
|
5953
|
|
|
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); |
|
5954
|
|
|
$link.addClass(ClassName.ACTIVE); |
|
5955
|
|
|
} else { |
|
5956
|
|
|
// Set triggered link as active |
|
5957
|
|
|
$link.addClass(ClassName.ACTIVE); // Set triggered links parents as active |
|
5958
|
|
|
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor |
|
5959
|
|
|
|
|
5960
|
|
|
$link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ", " + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE); // Handle special case when .nav-link is inside .nav-item |
|
5961
|
|
|
|
|
5962
|
|
|
$link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).children(Selector.NAV_LINKS).addClass(ClassName.ACTIVE); |
|
5963
|
|
|
} |
|
5964
|
|
|
|
|
5965
|
|
|
$$$1(this._scrollElement).trigger(Event.ACTIVATE, { |
|
5966
|
|
|
relatedTarget: target |
|
5967
|
|
|
}); |
|
5968
|
|
|
}; |
|
5969
|
|
|
|
|
5970
|
|
|
_proto._clear = function _clear() { |
|
5971
|
|
|
$$$1(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE); |
|
5972
|
|
|
}; // Static |
|
5973
|
|
|
|
|
5974
|
|
|
|
|
5975
|
|
|
ScrollSpy._jQueryInterface = function _jQueryInterface(config) { |
|
5976
|
|
|
return this.each(function () { |
|
5977
|
|
|
var data = $$$1(this).data(DATA_KEY); |
|
5978
|
|
|
|
|
5979
|
|
|
var _config = typeof config === 'object' && config; |
|
5980
|
|
|
|
|
5981
|
|
|
if (!data) { |
|
5982
|
|
|
data = new ScrollSpy(this, _config); |
|
5983
|
|
|
$$$1(this).data(DATA_KEY, data); |
|
5984
|
|
|
} |
|
5985
|
|
|
|
|
5986
|
|
|
if (typeof config === 'string') { |
|
5987
|
|
|
if (typeof data[config] === 'undefined') { |
|
5988
|
|
|
throw new TypeError("No method named \"" + config + "\""); |
|
5989
|
|
|
} |
|
5990
|
|
|
|
|
5991
|
|
|
data[config](); |
|
5992
|
|
|
} |
|
5993
|
|
|
}); |
|
5994
|
|
|
}; |
|
5995
|
|
|
|
|
5996
|
|
|
_createClass(ScrollSpy, null, [{ |
|
5997
|
|
|
key: "VERSION", |
|
5998
|
|
|
get: function get() { |
|
5999
|
|
|
return VERSION; |
|
6000
|
|
|
} |
|
6001
|
|
|
}, { |
|
6002
|
|
|
key: "Default", |
|
6003
|
|
|
get: function get() { |
|
6004
|
|
|
return Default; |
|
6005
|
|
|
} |
|
6006
|
|
|
}]); |
|
6007
|
|
|
return ScrollSpy; |
|
6008
|
|
|
}(); |
|
6009
|
|
|
/** |
|
6010
|
|
|
* ------------------------------------------------------------------------ |
|
6011
|
|
|
* Data Api implementation |
|
6012
|
|
|
* ------------------------------------------------------------------------ |
|
6013
|
|
|
*/ |
|
6014
|
|
|
|
|
6015
|
|
|
|
|
6016
|
|
|
$$$1(window).on(Event.LOAD_DATA_API, function () { |
|
6017
|
|
|
var scrollSpys = $$$1.makeArray($$$1(Selector.DATA_SPY)); |
|
6018
|
|
|
|
|
6019
|
|
|
for (var i = scrollSpys.length; i--;) { |
|
6020
|
|
|
var $spy = $$$1(scrollSpys[i]); |
|
6021
|
|
|
|
|
6022
|
|
|
ScrollSpy._jQueryInterface.call($spy, $spy.data()); |
|
6023
|
|
|
} |
|
6024
|
|
|
}); |
|
6025
|
|
|
/** |
|
6026
|
|
|
* ------------------------------------------------------------------------ |
|
6027
|
|
|
* jQuery |
|
6028
|
|
|
* ------------------------------------------------------------------------ |
|
6029
|
|
|
*/ |
|
6030
|
|
|
|
|
6031
|
|
|
$$$1.fn[NAME] = ScrollSpy._jQueryInterface; |
|
6032
|
|
|
$$$1.fn[NAME].Constructor = ScrollSpy; |
|
6033
|
|
|
|
|
6034
|
|
|
$$$1.fn[NAME].noConflict = function () { |
|
6035
|
|
|
$$$1.fn[NAME] = JQUERY_NO_CONFLICT; |
|
6036
|
|
|
return ScrollSpy._jQueryInterface; |
|
6037
|
|
|
}; |
|
6038
|
|
|
|
|
6039
|
|
|
return ScrollSpy; |
|
6040
|
|
|
}($); |
|
6041
|
|
|
|
|
6042
|
|
|
/** |
|
6043
|
|
|
* -------------------------------------------------------------------------- |
|
6044
|
|
|
* Bootstrap (v4.0.0): tab.js |
|
6045
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
6046
|
|
|
* -------------------------------------------------------------------------- |
|
6047
|
|
|
*/ |
|
6048
|
|
|
|
|
6049
|
|
|
var Tab = function ($$$1) { |
|
6050
|
|
|
/** |
|
6051
|
|
|
* ------------------------------------------------------------------------ |
|
6052
|
|
|
* Constants |
|
6053
|
|
|
* ------------------------------------------------------------------------ |
|
6054
|
|
|
*/ |
|
6055
|
|
|
var NAME = 'tab'; |
|
6056
|
|
|
var VERSION = '4.0.0'; |
|
6057
|
|
|
var DATA_KEY = 'bs.tab'; |
|
6058
|
|
|
var EVENT_KEY = "." + DATA_KEY; |
|
6059
|
|
|
var DATA_API_KEY = '.data-api'; |
|
6060
|
|
|
var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; |
|
6061
|
|
|
var TRANSITION_DURATION = 150; |
|
6062
|
|
|
var Event = { |
|
6063
|
|
|
HIDE: "hide" + EVENT_KEY, |
|
6064
|
|
|
HIDDEN: "hidden" + EVENT_KEY, |
|
6065
|
|
|
SHOW: "show" + EVENT_KEY, |
|
6066
|
|
|
SHOWN: "shown" + EVENT_KEY, |
|
6067
|
|
|
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY |
|
6068
|
|
|
}; |
|
6069
|
|
|
var ClassName = { |
|
6070
|
|
|
DROPDOWN_MENU: 'dropdown-menu', |
|
6071
|
|
|
ACTIVE: 'active', |
|
6072
|
|
|
DISABLED: 'disabled', |
|
6073
|
|
|
FADE: 'fade', |
|
6074
|
|
|
SHOW: 'show' |
|
6075
|
|
|
}; |
|
6076
|
|
|
var Selector = { |
|
6077
|
|
|
DROPDOWN: '.dropdown', |
|
6078
|
|
|
NAV_LIST_GROUP: '.nav, .list-group', |
|
6079
|
|
|
ACTIVE: '.active', |
|
6080
|
|
|
ACTIVE_UL: '> li > .active', |
|
6081
|
|
|
DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', |
|
6082
|
|
|
DROPDOWN_TOGGLE: '.dropdown-toggle', |
|
6083
|
|
|
DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active' |
|
6084
|
|
|
/** |
|
6085
|
|
|
* ------------------------------------------------------------------------ |
|
6086
|
|
|
* Class Definition |
|
6087
|
|
|
* ------------------------------------------------------------------------ |
|
6088
|
|
|
*/ |
|
6089
|
|
|
|
|
6090
|
|
|
}; |
|
6091
|
|
|
|
|
6092
|
|
|
var Tab = |
|
6093
|
|
|
/*#__PURE__*/ |
|
6094
|
|
|
function () { |
|
6095
|
|
|
function Tab(element) { |
|
6096
|
|
|
this._element = element; |
|
6097
|
|
|
} // Getters |
|
6098
|
|
|
|
|
6099
|
|
|
|
|
6100
|
|
|
var _proto = Tab.prototype; |
|
6101
|
|
|
|
|
6102
|
|
|
// Public |
|
6103
|
|
|
_proto.show = function show() { |
|
6104
|
|
|
var _this = this; |
|
6105
|
|
|
|
|
6106
|
|
|
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $$$1(this._element).hasClass(ClassName.ACTIVE) || $$$1(this._element).hasClass(ClassName.DISABLED)) { |
|
|
|
|
|
|
6107
|
|
|
return; |
|
6108
|
|
|
} |
|
6109
|
|
|
|
|
6110
|
|
|
var target; |
|
6111
|
|
|
var previous; |
|
6112
|
|
|
var listElement = $$$1(this._element).closest(Selector.NAV_LIST_GROUP)[0]; |
|
6113
|
|
|
var selector = Util.getSelectorFromElement(this._element); |
|
6114
|
|
|
|
|
6115
|
|
|
if (listElement) { |
|
6116
|
|
|
var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE; |
|
6117
|
|
|
previous = $$$1.makeArray($$$1(listElement).find(itemSelector)); |
|
6118
|
|
|
previous = previous[previous.length - 1]; |
|
6119
|
|
|
} |
|
6120
|
|
|
|
|
6121
|
|
|
var hideEvent = $$$1.Event(Event.HIDE, { |
|
6122
|
|
|
relatedTarget: this._element |
|
6123
|
|
|
}); |
|
6124
|
|
|
var showEvent = $$$1.Event(Event.SHOW, { |
|
6125
|
|
|
relatedTarget: previous |
|
|
|
|
|
|
6126
|
|
|
}); |
|
6127
|
|
|
|
|
6128
|
|
|
if (previous) { |
|
6129
|
|
|
$$$1(previous).trigger(hideEvent); |
|
6130
|
|
|
} |
|
6131
|
|
|
|
|
6132
|
|
|
$$$1(this._element).trigger(showEvent); |
|
6133
|
|
|
|
|
6134
|
|
|
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { |
|
6135
|
|
|
return; |
|
6136
|
|
|
} |
|
6137
|
|
|
|
|
6138
|
|
|
if (selector) { |
|
6139
|
|
|
target = $$$1(selector)[0]; |
|
6140
|
|
|
} |
|
6141
|
|
|
|
|
6142
|
|
|
this._activate(this._element, listElement); |
|
6143
|
|
|
|
|
6144
|
|
|
var complete = function complete() { |
|
6145
|
|
|
var hiddenEvent = $$$1.Event(Event.HIDDEN, { |
|
6146
|
|
|
relatedTarget: _this._element |
|
6147
|
|
|
}); |
|
6148
|
|
|
var shownEvent = $$$1.Event(Event.SHOWN, { |
|
6149
|
|
|
relatedTarget: previous |
|
|
|
|
|
|
6150
|
|
|
}); |
|
6151
|
|
|
$$$1(previous).trigger(hiddenEvent); |
|
6152
|
|
|
$$$1(_this._element).trigger(shownEvent); |
|
6153
|
|
|
}; |
|
6154
|
|
|
|
|
6155
|
|
|
if (target) { |
|
6156
|
|
|
this._activate(target, target.parentNode, complete); |
|
6157
|
|
|
} else { |
|
6158
|
|
|
complete(); |
|
6159
|
|
|
} |
|
6160
|
|
|
}; |
|
6161
|
|
|
|
|
6162
|
|
|
_proto.dispose = function dispose() { |
|
6163
|
|
|
$$$1.removeData(this._element, DATA_KEY); |
|
6164
|
|
|
this._element = null; |
|
6165
|
|
|
}; // Private |
|
6166
|
|
|
|
|
6167
|
|
|
|
|
6168
|
|
|
_proto._activate = function _activate(element, container, callback) { |
|
6169
|
|
|
var _this2 = this; |
|
6170
|
|
|
|
|
6171
|
|
|
var activeElements; |
|
6172
|
|
|
|
|
6173
|
|
|
if (container.nodeName === 'UL') { |
|
6174
|
|
|
activeElements = $$$1(container).find(Selector.ACTIVE_UL); |
|
6175
|
|
|
} else { |
|
6176
|
|
|
activeElements = $$$1(container).children(Selector.ACTIVE); |
|
6177
|
|
|
} |
|
6178
|
|
|
|
|
6179
|
|
|
var active = activeElements[0]; |
|
6180
|
|
|
var isTransitioning = callback && Util.supportsTransitionEnd() && active && $$$1(active).hasClass(ClassName.FADE); |
|
6181
|
|
|
|
|
6182
|
|
|
var complete = function complete() { |
|
6183
|
|
|
return _this2._transitionComplete(element, active, callback); |
|
6184
|
|
|
}; |
|
6185
|
|
|
|
|
6186
|
|
|
if (active && isTransitioning) { |
|
6187
|
|
|
$$$1(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); |
|
6188
|
|
|
} else { |
|
6189
|
|
|
complete(); |
|
6190
|
|
|
} |
|
6191
|
|
|
}; |
|
6192
|
|
|
|
|
6193
|
|
|
_proto._transitionComplete = function _transitionComplete(element, active, callback) { |
|
6194
|
|
|
if (active) { |
|
6195
|
|
|
$$$1(active).removeClass(ClassName.SHOW + " " + ClassName.ACTIVE); |
|
6196
|
|
|
var dropdownChild = $$$1(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0]; |
|
6197
|
|
|
|
|
6198
|
|
|
if (dropdownChild) { |
|
6199
|
|
|
$$$1(dropdownChild).removeClass(ClassName.ACTIVE); |
|
6200
|
|
|
} |
|
6201
|
|
|
|
|
6202
|
|
|
if (active.getAttribute('role') === 'tab') { |
|
6203
|
|
|
active.setAttribute('aria-selected', false); |
|
6204
|
|
|
} |
|
6205
|
|
|
} |
|
6206
|
|
|
|
|
6207
|
|
|
$$$1(element).addClass(ClassName.ACTIVE); |
|
6208
|
|
|
|
|
6209
|
|
|
if (element.getAttribute('role') === 'tab') { |
|
6210
|
|
|
element.setAttribute('aria-selected', true); |
|
6211
|
|
|
} |
|
6212
|
|
|
|
|
6213
|
|
|
Util.reflow(element); |
|
6214
|
|
|
$$$1(element).addClass(ClassName.SHOW); |
|
6215
|
|
|
|
|
6216
|
|
|
if (element.parentNode && $$$1(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) { |
|
6217
|
|
|
var dropdownElement = $$$1(element).closest(Selector.DROPDOWN)[0]; |
|
6218
|
|
|
|
|
6219
|
|
|
if (dropdownElement) { |
|
6220
|
|
|
$$$1(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); |
|
6221
|
|
|
} |
|
6222
|
|
|
|
|
6223
|
|
|
element.setAttribute('aria-expanded', true); |
|
6224
|
|
|
} |
|
6225
|
|
|
|
|
6226
|
|
|
if (callback) { |
|
6227
|
|
|
callback(); |
|
6228
|
|
|
} |
|
6229
|
|
|
}; // Static |
|
6230
|
|
|
|
|
6231
|
|
|
|
|
6232
|
|
|
Tab._jQueryInterface = function _jQueryInterface(config) { |
|
6233
|
|
|
return this.each(function () { |
|
6234
|
|
|
var $this = $$$1(this); |
|
6235
|
|
|
var data = $this.data(DATA_KEY); |
|
6236
|
|
|
|
|
6237
|
|
|
if (!data) { |
|
6238
|
|
|
data = new Tab(this); |
|
6239
|
|
|
$this.data(DATA_KEY, data); |
|
6240
|
|
|
} |
|
6241
|
|
|
|
|
6242
|
|
|
if (typeof config === 'string') { |
|
6243
|
|
|
if (typeof data[config] === 'undefined') { |
|
6244
|
|
|
throw new TypeError("No method named \"" + config + "\""); |
|
6245
|
|
|
} |
|
6246
|
|
|
|
|
6247
|
|
|
data[config](); |
|
6248
|
|
|
} |
|
6249
|
|
|
}); |
|
6250
|
|
|
}; |
|
6251
|
|
|
|
|
6252
|
|
|
_createClass(Tab, null, [{ |
|
6253
|
|
|
key: "VERSION", |
|
6254
|
|
|
get: function get() { |
|
6255
|
|
|
return VERSION; |
|
6256
|
|
|
} |
|
6257
|
|
|
}]); |
|
6258
|
|
|
return Tab; |
|
6259
|
|
|
}(); |
|
6260
|
|
|
/** |
|
6261
|
|
|
* ------------------------------------------------------------------------ |
|
6262
|
|
|
* Data Api implementation |
|
6263
|
|
|
* ------------------------------------------------------------------------ |
|
6264
|
|
|
*/ |
|
6265
|
|
|
|
|
6266
|
|
|
|
|
6267
|
|
|
$$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { |
|
6268
|
|
|
event.preventDefault(); |
|
6269
|
|
|
|
|
6270
|
|
|
Tab._jQueryInterface.call($$$1(this), 'show'); |
|
6271
|
|
|
}); |
|
6272
|
|
|
/** |
|
6273
|
|
|
* ------------------------------------------------------------------------ |
|
6274
|
|
|
* jQuery |
|
6275
|
|
|
* ------------------------------------------------------------------------ |
|
6276
|
|
|
*/ |
|
6277
|
|
|
|
|
6278
|
|
|
$$$1.fn[NAME] = Tab._jQueryInterface; |
|
6279
|
|
|
$$$1.fn[NAME].Constructor = Tab; |
|
6280
|
|
|
|
|
6281
|
|
|
$$$1.fn[NAME].noConflict = function () { |
|
6282
|
|
|
$$$1.fn[NAME] = JQUERY_NO_CONFLICT; |
|
6283
|
|
|
return Tab._jQueryInterface; |
|
6284
|
|
|
}; |
|
6285
|
|
|
|
|
6286
|
|
|
return Tab; |
|
6287
|
|
|
}($); |
|
6288
|
|
|
|
|
6289
|
|
|
/** |
|
6290
|
|
|
* -------------------------------------------------------------------------- |
|
6291
|
|
|
* Bootstrap (v4.0.0-alpha.6): index.js |
|
6292
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|
6293
|
|
|
* -------------------------------------------------------------------------- |
|
6294
|
|
|
*/ |
|
6295
|
|
|
|
|
6296
|
|
|
(function ($$$1) { |
|
6297
|
|
|
if (typeof $$$1 === 'undefined') { |
|
6298
|
|
|
throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); |
|
6299
|
|
|
} |
|
6300
|
|
|
|
|
6301
|
|
|
var version = $$$1.fn.jquery.split(' ')[0].split('.'); |
|
6302
|
|
|
var minMajor = 1; |
|
6303
|
|
|
var ltMajor = 2; |
|
6304
|
|
|
var minMinor = 9; |
|
6305
|
|
|
var minPatch = 1; |
|
6306
|
|
|
var maxMajor = 4; |
|
6307
|
|
|
|
|
6308
|
|
|
if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { |
|
6309
|
|
|
throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); |
|
6310
|
|
|
} |
|
6311
|
|
|
})($); |
|
6312
|
|
|
|
|
6313
|
|
|
exports.Util = Util; |
|
6314
|
|
|
exports.Alert = Alert; |
|
6315
|
|
|
exports.Button = Button; |
|
6316
|
|
|
exports.Carousel = Carousel; |
|
6317
|
|
|
exports.Collapse = Collapse; |
|
6318
|
|
|
exports.Dropdown = Dropdown; |
|
6319
|
|
|
exports.Modal = Modal; |
|
6320
|
|
|
exports.Popover = Popover; |
|
6321
|
|
|
exports.Scrollspy = ScrollSpy; |
|
6322
|
|
|
exports.Tab = Tab; |
|
6323
|
|
|
exports.Tooltip = Tooltip; |
|
6324
|
|
|
|
|
6325
|
|
|
Object.defineProperty(exports, '__esModule', { value: true }); |
|
6326
|
|
|
|
|
6327
|
|
|
}))); |
|
6328
|
|
|
//# sourceMappingURL=bootstrap.bundle.js.map |
|
6329
|
|
|
|